Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | PHP Problem - File Uploads

You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > Internet Discussion

PHP Problem - File Uploads
Reply
 
Thread Tools
Old 31-03-2006, 21:42   #1
Graham M
Inactive
 
Graham M's Avatar
 
Join Date: Jul 2003
Location: Poole, Dorset
Age: 41
Services: FreeSat+ Tivo V-Box VM 60MBit
Posts: 13,365
Graham M has a pair of shiny starsGraham M has a pair of shiny stars
Graham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny stars
Send a message via MSN to Graham M Send a message via Yahoo to Graham M
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.
Graham M is offline   Reply With Quote
Advertisement
Old 31-03-2006, 21:50   #2
Paul
Dr Pepper Addict
Cable Forum Admin
 
Paul's Avatar
 
Join Date: Oct 2003
Location: Nottingham
Age: 63
Services: Zen & YouFibre FTTP, Sky Q TV, Sky Mobile, Flextel SIP
Posts: 31,292
Paul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered stars
Paul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered stars
Re: PHP Problem - File Uploads

How big is it ?
__________________

Baby, I was born this way.
Paul is offline   Reply With Quote
Old 31-03-2006, 21:53   #3
Graham M
Inactive
 
Graham M's Avatar
 
Join Date: Jul 2003
Location: Poole, Dorset
Age: 41
Services: FreeSat+ Tivo V-Box VM 60MBit
Posts: 13,365
Graham M has a pair of shiny starsGraham M has a pair of shiny stars
Graham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny stars
Send a message via MSN to Graham M Send a message via Yahoo to Graham M
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?
Graham M is offline   Reply With Quote
Old 01-04-2006, 10:28   #4
KingPhoenix
Inactive
 
KingPhoenix's Avatar
 
Join Date: Jun 2003
Location: On top of this heat sink
Age: 46
Services: Sky+ & 8mb ADSL + BT Together option 3
Posts: 2,345
KingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze array
KingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze array
Send a message via MSN to KingPhoenix
Re: PHP Problem - File Uploads

Which version of PHP is it?
KingPhoenix is offline   Reply With Quote
Old 01-04-2006, 15:19   #5
v0id
[CENSORED]
 
v0id's Avatar
 
Join Date: Apr 2005
Location: Wolverhampton
Age: 48
Posts: 4,218
v0id has a bronzed appealv0id has a bronzed appeal
v0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appealv0id has a bronzed appeal
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
__________________
Help save the world from loosers

v0id is offline   Reply With Quote
Old 01-04-2006, 15:20   #6
Graham M
Inactive
 
Graham M's Avatar
 
Join Date: Jul 2003
Location: Poole, Dorset
Age: 41
Services: FreeSat+ Tivo V-Box VM 60MBit
Posts: 13,365
Graham M has a pair of shiny starsGraham M has a pair of shiny stars
Graham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny stars
Send a message via MSN to Graham M Send a message via Yahoo to Graham M
Re: PHP Problem - File Uploads

Quote:
Originally Posted by KingPhoenix
Which version of PHP is it?
4.4, should I try updating?
Graham M is offline   Reply With Quote
Old 01-04-2006, 15:46   #7
KingPhoenix
Inactive
 
KingPhoenix's Avatar
 
Join Date: Jun 2003
Location: On top of this heat sink
Age: 46
Services: Sky+ & 8mb ADSL + BT Together option 3
Posts: 2,345
KingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze array
KingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze arrayKingPhoenix has a bronze array
Send a message via MSN to KingPhoenix
Re: PHP Problem - File Uploads

Quote:
Originally Posted by Zeph
4.4, should I try updating?
4.4 should be fine, im assuming your using a linux box (hence the /tmp)

Is it a script youve written, or a well used script? Im assuming you have full admin over the box its running on?
KingPhoenix is offline   Reply With Quote
Old 01-04-2006, 15:54   #8
punky
Inactive
 
Join Date: Jun 2003
Age: 45
Posts: 14,750
punky has a golden aurapunky has a golden aura
punky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aura
Re: PHP Problem - File Uploads

Make sure the upload dir and temp upload dir have the right permissions. chmod it to 755 or something.
punky is offline   Reply With Quote
Old 16-04-2006, 18:05   #9
Graham M
Inactive
 
Graham M's Avatar
 
Join Date: Jul 2003
Location: Poole, Dorset
Age: 41
Services: FreeSat+ Tivo V-Box VM 60MBit
Posts: 13,365
Graham M has a pair of shiny starsGraham M has a pair of shiny stars
Graham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny stars
Send a message via MSN to Graham M Send a message via Yahoo to Graham M
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
(
    [name] => P1010010.JPG
    [type] => image/jpeg
    [tmp_name] => /tmp/phptuNXV4
    [error] => 0
    [size] => 854952
)
Graham M is offline   Reply With Quote
Old 16-04-2006, 18:24   #10
Strzelecki
Inactive
 
Join Date: Jan 2004
Location: Essex
Age: 43
Services: 80/20Mbps FTTC on Freeola
Posts: 871
Strzelecki has reached the bronze age
Strzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze age
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.
Strzelecki is offline   Reply With Quote
Old 16-04-2006, 18:37   #11
Graham M
Inactive
 
Graham M's Avatar
 
Join Date: Jul 2003
Location: Poole, Dorset
Age: 41
Services: FreeSat+ Tivo V-Box VM 60MBit
Posts: 13,365
Graham M has a pair of shiny starsGraham M has a pair of shiny stars
Graham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny stars
Send a message via MSN to Graham M Send a message via Yahoo to Graham M
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
Graham M is offline   Reply With Quote
Old 16-04-2006, 18:52   #12
Paul
Dr Pepper Addict
Cable Forum Admin
 
Paul's Avatar
 
Join Date: Oct 2003
Location: Nottingham
Age: 63
Services: Zen & YouFibre FTTP, Sky Q TV, Sky Mobile, Flextel SIP
Posts: 31,292
Paul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered stars
Paul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered stars
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 ).
__________________

Baby, I was born this way.
Paul is offline   Reply With Quote
Old 16-04-2006, 19:06   #13
Graham M
Inactive
 
Graham M's Avatar
 
Join Date: Jul 2003
Location: Poole, Dorset
Age: 41
Services: FreeSat+ Tivo V-Box VM 60MBit
Posts: 13,365
Graham M has a pair of shiny starsGraham M has a pair of shiny stars
Graham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny starsGraham M has a pair of shiny stars
Send a message via MSN to Graham M Send a message via Yahoo to Graham M
Re: PHP Problem - File Uploads

Yep Safe Mode is off. I can post my php.ini if you think that will help
Graham M is offline   Reply With Quote
Reply

Thread Tools

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

Forum Jump


All times are GMT. The time now is 22:15.


Server: lithium.zmnt.uk
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum