Solved

CSV File Fails To Upload

Posted on 2011-03-22
3
278 Views
Last Modified: 2012-05-11
Hi

I attached the csv file that fails to upload. Any other csv file will upload just fine.

wp-posts.csv

The difference is probably encoding but I wanted to confirm this or get another reason why $_FILES['file'] shows a fail straight away with this file and not many other csv files I have.

Also what is the best way to properly dedect the reason so I can notify the user?

Thank you for any help
Ryan
0
Comment
Question by:Ryan Bayne
3 Comments
 
LVL 14

Accepted Solution

by:
Scott Madeira earned 125 total points
Comment Utility
Check your maximum file upload size and then compare that to the size of this file and the other CSV files you are uploading.  The attached CSV is 5.7 MB.  If your limit is set to 4MB that would cause a problem.

you can get max file size from php.ini or run a phpinfo() script...
0
 
LVL 42

Expert Comment

by:Chris Stanyon
Comment Utility
Without seeing more code, or specific errors, it's difficult to tell what could be causing your problems. Turning on error reporting in PHP may help by outputting any errors to the screen.

To turn on error reporting, add the following lines to your php script and then try running your upload again.

Also, the default upload limit for sending files is 2mb. Unless you've changed this, that could also be the problem (the file you've attached is 5.7mb).


ini_set('display_errors',1); 
error_reporting(E_ALL);

Open in new window

0
 
LVL 2

Author Comment

by:Ryan Bayne
Comment Utility
Your file size  suggestion got me thinking, what if the file size limit being shown to me on the page is not the limit being enforced.

That is what the issue is. I'm displaying the servers limit as 30mb but in fact it is really 2mb. It is a developer plugin I tested to see how easy it could increase the limit. I just assumed it worked and forgot about it.

Thanks for jogging my memory.
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

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

762 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

6 Experts available now in Live!

Get 1:1 Help Now