Solved

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

Posted on 2016-07-19
2
66 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 109

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

809 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