Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-28-2006, 01:15 PM   #1
In Runtime
 
j.venning's Avatar
 
Join Date: Mar 2006
Posts: 220
Send a message via ICQ to j.venning Send a message via MSN to j.venning
Default PHP Upload Script Modification

Hi everyone! Have just implemented a new upload script on my website, its in PHP but I would like to make it a bit more advance.

Currently, all files get uploaded to http://www.vee-media.com/upload/ but I would really prefer for each file to get a unique location e.g http://www.vee-media.com/fas09jasf/ . I think that this would be a good idea because all the uploaded files wont stay in the same place.

Also, I would also like to put an upload status bar or window when uploading? Does anyone know how I could achieve this?

Here is the script:

PHP Code:
<?php 
$target 
"upload/"
$target $target basename$_FILES['uploaded']['name']) ; 
$ok=1
if(
move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
{
$URL="http://www.vee-media.com/uploaded.html";
header ("Location: $URL");
}


?>
I would be very grateful for any help!

Regards,
AJ.

P.S Hope you had a merry christmas and have a good new year!
__________________

__________________
Brand new setup!

Intel Core 2 Quad Extreme Edition QX6800 (2.93GHz)
Intel Extreme D975XBX2KR Motherboard
BFG GeForce 8800 GTX 768MB GDDR3
Corsair 2GB DDR2 XMS2 Dominator RAM
Thermaltake VE2000SWA Armour LCS Super Tower
Western Digital Raptor X 150GB X2
j.venning is offline   Reply With Quote
Old 12-28-2006, 04:32 PM   #2
j03
~~~~~~~~
 
Join Date: Jan 2005
Location: Wales
Posts: 5,556
Send a message via MSN to j03
Default Re: PHP Upload Script Modification

Well, i am not sure exactly how to do the status bar, but i would imagine it would be utilizing PHP & JavaScript. The user would have to select there internet speed, and then, the PHP Script would find out how big the file it, and pass it on to the javascript so that it can work out how long it would take, based on the File Size, and the Users Connection Speed. I have got a file upload script on my server, and it automatically adds 4 random digits to the front of the file name, so that no files get overwritten. I did not write the script my self, but if you like, i can give you the source. Just reply if you want it!

Oh, and on your website (if it is yours), since it's publicly available, i would advidse you to filter out all files with an extention of .php, because that is a MAJOR Security risk. Do somthing like this:

PHP Code:
str_replace("php, phps, $filename"); 


Oh, and this is post number 600 YAY!

That will replace the .php extention with .phps (which mean php source)
__________________

j03 is offline   Reply With Quote
Old 12-28-2006, 05:13 PM   #3
In Runtime
 
j.venning's Avatar
 
Join Date: Mar 2006
Posts: 220
Send a message via ICQ to j.venning Send a message via MSN to j.venning
Default Re: PHP Upload Script Modification

Thanks for your reply samurai! Some very helpful info! Do you have MSN or some other IM / IRC so we could chat?

Cheers,
AJ
__________________
Brand new setup!

Intel Core 2 Quad Extreme Edition QX6800 (2.93GHz)
Intel Extreme D975XBX2KR Motherboard
BFG GeForce 8800 GTX 768MB GDDR3
Corsair 2GB DDR2 XMS2 Dominator RAM
Thermaltake VE2000SWA Armour LCS Super Tower
Western Digital Raptor X 150GB X2
j.venning is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 12:02 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0