Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - PHP - Can't upload big files | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7621/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
I wrote a simple file upload script, nothing too special but it works. The problem is it fails with large files (worked fine with 20K but failed with 6MB). I imagine this is due to the upload_max_filesize in php.ini. Is it possible for me to at least know what this is set to? I don't think I can change it. Is it possible to 'bypass' by handling the file in chunks or something crazy like that? Also are there any security issues involved with allowing any file to be uploaded, but tacking random numbers onto its extension? I checked that a file like 'blah.php47567568' is treated as text, not as PHP (and the numbers are 7 digits so it won't ever come out as .php3 or some such ), but I don't know if other types of files will be handled the same way. |
|||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 651/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
Originally posted by HyperFapperThere's a magical PHP function called phpinfo(); that tells you all kinds of faptastic info. Just make a PHP file with that in it, save it as something like info.php, upload it, visit it in your browser, and use CTRL+F to search for upload_max_filesize. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7641/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Ah, should have thought of that. As I feared, it's set to the default 2MB. Don't suppose it's possible to bypass? I need to upload a few files up to 50MB each, just once... I'll ask the admins but I doubt they'll do it. (edited by HyperFapper on 10-12-05 09:01 PM) |
|||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 652/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
I don't know of a way to bypass it, but then again, I'm still a PHP novice, and I don't know how to make an FTP PHP script to begin with. However, if you can't find a way to bypass it, and/or the admins won't raise it, the only option I can think of is RAR... RAR the files you want to upload, and when you make the archive, choose to split it into 1.98MB files. This way, you have a little breathing room before you hit the 2MB limit. With a 50MB file, you'll end up with about 26 parts, which won't be fun, but they'll be there. Of course, if you're not uploading the files from place A so you can go to place B and download them later, then RAR probably isn't a viable option... |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7656/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Yeah, I figured that would be it. Not really a good option, because the files are like 50MB and don't compress well. But I got them from elsewhere anyway. And the uploader will come in handy for other things. |
|||
sloat Level: 16 Posts: 85/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
check out ini_set() | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7669/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Thanks! I didn't think scripts would be allowed to override the settings. Is there a way to set the size to unlimited? This script is only for administrative (read: my) use anyway, so there's no need for a limit. [edit] 6MB uploads still fail with upload_max_filesize at 50MB and max_input_time at 300 seconds. (And it didn't appear to take 5 minutes.) post_max_size is already 55MB. No errors show up, it just doesn't upload and move_uploaded_file() fails. (edited by HyperHacker on 10-13-05 08:26 PM) |
|||
Ragnara Octorok Level: 7 Posts: 25/28 EXP: 1265 For next: 183 Since: 08-21-05 From: Germany Since last post: 17 days Last activity: 13 hours |
| ||
You could also upload your files in small chunks and then have a php script copy these parts into a single file, couldn't you? | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7704/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Possibly, but I would need to split them manually, which isn't really going to work so well. | |||
Narf Hi Tuvai! (reregistering while banned) Level: 16 Posts: 91/100 EXP: 17634 For next: 2622 Since: 12-26-04 Since last post: 22 hours Last activity: 14 hours |
| ||
Post the script you're using. | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7713/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
<?php Interestingly enough, when the upload fails, it says the file is 0 bytes. |
|||
Narf Hi Tuvai! (reregistering while banned) Level: 16 Posts: 92/100 EXP: 17634 For next: 2622 Since: 12-26-04 Since last post: 22 hours Last activity: 14 hours |
| ||
Try using the script I posted in this thread, be sure to change the 50 to 50000 though if you want to upload 50 MB files. | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7791/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Er... what exactly does that do differently than mine? | |||
Boom.dk Level: 31 Posts: 388/392 EXP: 168692 For next: 16671 Since: 07-18-04 From: Denmark Since last post: 10 days Last activity: 1 day |
| ||
Nothing as far as I can tell... If you got FTP access to your webspace, you should make a script that uploads with FTP instead of the traditional way. For more information: http://www.php.net/manual/en/ref.ftp.php (edited by Boom.dk on 10-18-05 12:46 PM) |
|||
Narf Hi Tuvai! (reregistering while banned) Level: 16 Posts: 93/100 EXP: 17634 For next: 2622 Since: 12-26-04 Since last post: 22 hours Last activity: 14 hours |
| ||
Originally posted by Santa ClausShouldn't be any major differences, but mine just looks cleaner and doesn't have a shitload of unnecesary lines, variables and definitions so it's easier to trace bugs in it, would they occur. =) |
|||
Boom.dk Level: 31 Posts: 392/392 EXP: 168692 For next: 16671 Since: 07-18-04 From: Denmark Since last post: 10 days Last activity: 1 day |
| ||
To me, nothing looks unneccesary in HH's script. It all has its use. | |||
mekakame Micro-Goomba Level: 7 Posts: 17/18 EXP: 925 For next: 523 Since: 06-08-05 From: Samut Prakan, Thailand, Asia, Earth, Milky Way, Space... Since last post: 5 days Last activity: 1 day |
| ||
Does this also? C:\Windows\php.ini, Line 372 ; Maximum size of POST data that PHP will accept. post_max_size = 8M And your code: <form name="ul" enctype="multipart/form-data" action="upload.php" method="POST"> As you see, it was also send in post method |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 8007/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
You mean the MAX_FILE_SIZE field? It's supposed to tell the browser what size is allowed (though it doesn't seem to do much). Of course it could be spoofed pretty easy, so I don't rely on its value being correct when the form is submitted. | |||
mekakame Micro-Goomba Level: 7 Posts: 18/18 EXP: 925 For next: 523 Since: 06-08-05 From: Samut Prakan, Thailand, Asia, Earth, Milky Way, Space... Since last post: 5 days Last activity: 1 day |
| ||
I think there are both post_max_size and also upload_max_filesize too. PHP will only accept first .......... of data in post method. Thay's what I think. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - PHP - Can't upload big files | | | |