Solved

PHP move_uploaded_file fails for ZIP files but not for JPG or PDF

Posted on 2016-07-19
2
50 Views
Last Modified: 2016-07-19
I have a file upload page which uses AJAX to upload three versions of a print document and process them into an image library. The files are uploaded one at a time in the order PDF, JPG, ZIP. The PDF and JPG files are being accepted and moved into the folder for processing but the ZIP file fails after completing the upload. All three files have exactly the same name except for the extension. The error log is listing two errors, a "no such file or directory" error and an "unable to move file" error.

Is there reason that it would reject ZIPs but not PDFs and JPGs? PHP version is 5.3.3.
0
Comment
Question by:Kim Walker
2 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 41719629
Don't know of anything that might cause this.  Are they all being moved to the same directory?
0
 
LVL 22

Author Closing Comment

by:Kim Walker
ID: 41719658
@Ray, Bull's Eye!

I thought they were. I wrote the code several months ago and didn't remember or notice that zip files were being moved directly to the post-processed folder. In this case, a new category was being created and the folder which would accept the post-processed JPG and PDF hadn't been created yet. I've added a line in the script to create the folder if it doesn't already exist.

I had already figured it out and was testing the fix when I received the notice that you had commented. But you get the golden egg anyway.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now