Solved

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

Posted on 2016-07-19
2
38 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
Comment Utility
Don't know of anything that might cause this.  Are they all being moved to the same directory?
0
 
LVL 21

Author Closing Comment

by:Kim Walker
Comment Utility
@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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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 …
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

771 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

7 Experts available now in Live!

Get 1:1 Help Now