Forums

PHP

This topic is locked

PHP File upload problem

Posted 31 Jul 2008 14:46:39
1
has voted
31 Jul 2008 14:46:39 Jon Martin posted:
<font face='Arial'>Hello all!

I'm a first time poster and relatively new to the world of PHP, so please be gentle with me. I promise not to bite or be too slow...

I'm writing a file upload script for a web system we're reworking for someone. I have two pages, the first is used to select the file to be uploaded and on completion jumps to the second to confirm the upload and use move_uploaded_file to transfer it to a permanent directory on the webserver.

Everything appears to work fine with no errors reported by move_uploaded_file. However the file does not get uploaded on first attempt. If I manually refresh the 2nd page (in which move_uploaded_file is run), it uploads absolutely fine.

The big issue is that move_uploaded_file doesn't appear to report an error even thought the file is not moved, and so I can't build in effective error trapping to run it again. This to me is a workaround anyway, and I'm sure there's a better solution.

I've tried all kind of tags/scripts to either refresh the page or not cache the page but nothing appears to work unless I run a manual refresh.

Is this a common problem, and am I missing something incredibly obvious? I can post the code if needs be.

Thanks in advance!


Jon


</font id='Arial'>

Reply to this topic