简体   繁体   中英

Ajax file upload with jquery not working

I grabbed this code online(sanwebe.com) and I'm trying to use it as the basis for a "flyer wizard" where our customers will be able to upload their company logo onto a flyer and then print, but I can't quite get it to work. It keeps saying "error uploading file!" and doesn't display the photo. I've tried numerous file types which are all included in the accepted filetypes. The two primary files that I think may have the issue are index.php and/or processupload.php. There's an online demo that seems to work fine uploading an image and displaying it, but the version I downloaded doesn't work. I called godaddy and had the recommended settings (in the comments in the processupload.php file) in the php.ini file updated and also restarted our server, but still no luck.

Link to online demo (that works): http://www.sanwebe.com/assets/ajax-image-upload-progressbar/

Link to tutorial/download/forum page: http://www.sanwebe.com/2012/06/ajax-file-upload-with-php-and-jquery/comment-page-1#comments

I think can be a permission problem so your server doesn't allow to upload files.

If you are using apache you can create a new group with both the apache user and FTP user as members and then make the permission on the upload folder 775. This should give both the apache and FTP users the ability to write to the files in the folder but keep everyone else from modifying them.

I looked around some more and found there were more than one "example code" download pages with a tutorial, and I had downloaded the wrong one without the code to actually display the image. Below is the link to the correct one. It works great.

http://www.sanwebe.com/2012/05/ajax-image-upload-and-resize-with-jquery-and-php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM