![]() |
PHP Problem - File Uploads
Hi there, I know we have plenty of PHP Whizzes around here, I count myself as being fairly good at it but im stuck on a problem now that is probably caused by improper server configuration.
I had the same script working fine on another server but now for some reason it won't on my new one and yes PHP file uploads are enabled and seem to be set correctly in php.ini I have a file upload form which appears to work correctly; when I redirect the form action to a file containing phpinfo(); it shows that the upload variables have been set and gives a path to the image, but the file never appears in the upload directory (/tmp) I have tried changing the upload directory and altering the permissions on the folder but no joy so far. Any clues? Thanks. |
Re: PHP Problem - File Uploads
How big is it ?
|
Re: PHP Problem - File Uploads
Ive tried several different sizes from a few k to a few hundred, the variable for max size is set to 2M in the php.ini and if I went over that, the phpinfo(); would report a file upload error wouldnt it?
|
Re: PHP Problem - File Uploads
Which version of PHP is it?
|
Re: PHP Problem - File Uploads
could always try adding
php_value upload_max_filesize xM to your .htaccess file, where x is the file size you want |
Re: PHP Problem - File Uploads
Quote:
|
Re: PHP Problem - File Uploads
Quote:
Is it a script youve written, or a well used script? Im assuming you have full admin over the box its running on? |
Re: PHP Problem - File Uploads
Make sure the upload dir and temp upload dir have the right permissions. chmod it to 755 or something.
|
Re: PHP Problem - File Uploads
Yep ive tried all sorts. the weirdest thing, I've just tried uploading a larger file (1mb) and the file uploads (i can "ls" on the console) and i do it several times during the upload and its there increasing in size, but all of a sudden when the upload "completes" the file disappears???
---------- Post added at 19:03 ---------- Previous post was at 18:57 ---------- Here are 2 Subsequent LSs one straight after the other in between it being there and disappearing root@server [/tmp]# ls -l total 837 drwxrwxrwx 2 root root 1024 Apr 16 19:02 ./ drwxr-xr-x 18 root root 1024 Apr 16 02:07 ../ -rwx------ 1 nobody nobody 0 Apr 14 10:06 _23901_1705_1606.wrk* -rwx------ 1 nobody nobody 0 Apr 15 16:40 _23901_3535_3436.wrk* -rwx------ 1 nobody nobody 0 Apr 16 19:02 _25935_101_2.wrk* -rwx------ 1 nobody nobody 0 Apr 14 12:56 _32102_2004_1905.wrk* lrwxr-xr-x 1 root root 30 Apr 16 19:01 mysql.sock -> ../../var/lib/mysql/mysql.sock= -rw------- 1 nobody nobody 849754 Apr 16 19:02 phptuNXV4 root@server [/tmp]# ls -l total 2 drwxrwxrwx 2 root root 1024 Apr 16 19:02 ./ drwxr-xr-x 18 root root 1024 Apr 16 02:07 ../ -rwx------ 1 nobody nobody 0 Apr 14 10:06 _23901_1705_1606.wrk* -rwx------ 1 nobody nobody 0 Apr 15 16:40 _23901_3535_3436.wrk* -rwx------ 1 nobody nobody 0 Apr 14 12:56 _32102_2004_1905.wrk* lrwxr-xr-x 1 root root 30 Apr 16 19:01 mysql.sock -> ../../var/lib/mysql/mysql.sock= ---------- Post added at 19:05 ---------- Previous post was at 19:03 ---------- PHP Reports the following: Code:
_FILES["UploadFile"]Array |
Re: PHP Problem - File Uploads
I had a similar problem to this a while back. I think I used the sleep() function to pause the script once the file is uploaded to give it time to actually be written to the disk. Weird I know, but it did work.
Edit: Oops, it was clearstatcache(); I used. |
Re: PHP Problem - File Uploads
Yes but as soon as the file is uploaded, it gets passed onto another script to handle it, this shouldnt make a difference
|
Re: PHP Problem - File Uploads
Just a thought - your not running php in safe mode are you ?
( I just spent 30 mins puzzling over why something was failing on the test system, only to find php was in safe mode :rolleyes: ). |
Re: PHP Problem - File Uploads
Yep Safe Mode is off. I can post my php.ini if you think that will help
|
| All times are GMT. The time now is 14:17. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum