File upload problem for specific file name

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Kennerd
Forum Newbie
Posts: 1
Joined: Wed May 28, 2008 3:40 am

File upload problem for specific file name

Post by Kennerd »

Hi,

Hopefully someone can help me on this, we did a lot of testing but can't find an explanation for the following:

We have a document management system in PHP that writes it's documents (attachments) to a linux server, in a folder named after the id of the record in the mysql database. Here's the situation:

Document 123 has a folder named '123' with rights 755, and '123' contains 'att123.pdf'...
Document 1234 has a folder named '1234' with rights 755 and '1234' contains no attachments, however we tried to upload 'att1234.doc'...

Trying to upload 'att1234.doc' again fails... We do notice that the modified date of folder '1234' changes every time we try to do this...

We did the following tests:
  • Upload 'att1234.doc' in folder '123' --> works! (so the problem doesn't lie with the attachment, it lies in the folder '1234' ??)
  • Upload 'att123.pdf' in folder '1234' --> works! (so the doesn't lie with the folder '1234' ???)
  • Upload 'att1234.doc' in folder '1234' after we succesfully uploaded 'att123.pdf'--> works! (what the hell ??? :? )
We are using the function move_uploaded_file(), but it does not return 'false'... We see no errors... It seems that the folder is 'corrupt' (possible??) for some reason and it becomes 'fixed' if we first upload a different attachment, and then re-upload the attachment that should have been uploaded the first time...

Addition: we also tried with renaming 'att1234.doc' to 'att1234xxx.doc' and this also works, so we don't really need to upload another attachment...

Any feedback, tips (solution! Wink), ... would be greatly appreciated.

Thanks!
Ken
Post Reply