In the official thinkphp example, the image uploaded under file cannot be saved in Upload.

Source: Internet
Author: User
In the official thinkphp example, if the image uploaded by file is not saved in Upload, I will create a database & nbsp; configure the database & nbsp; the previous curd & nbsp; ajax & nbsp; forms available & nbsp; When uploading files & nbsp; displayed successfully & nbsp; however, no images are saved under Upload. & in the official thinkphp example, the files uploaded images cannot be saved in Upload.
After I set up the database, the curd ajax form before the database is configured can be used to Upload files. it is displayed as successful, but the image is not saved under Upload. why? Is there a problem?

D: \ wamp \ www \ file \ Uploads:
Import ('@. ORG. uploadfile ');
// Import Upload class
$ Upload = new UploadFile ();
// Set the size of the uploaded file
$ Upload-> maxSize = 3292200;
// Set the Upload file type
$ Upload-> allowExts = explode (',', 'jpg, gif, png, jpeg ');
// Set the attachment Upload Directory
$ Upload-> savePath = './Uploads /';
// Set the thumbnail to be generated, which is only valid for image files
$ Upload-> thumb = true;
// Set the path of the referenced image library package
$ Upload-> imageClassPath = '@. ORG. image ';
// Set the file suffix for generating thumbnails
$ Upload-> thumbPrefix ='m _, s _ '; // produce two thumbnails.
// Set the maximum width of the thumbnail.
$ Upload-> thumbMaxWidth = '000000 ';
// Set the maximum height of the thumbnail.
$ Upload-> thumbMaxHeight = '000000 ';
// Set file Upload rules
$ Upload-> saveRule = 'uniqid ';



I haven't made any other changes. Why can't I show images?
Novice
------ Solution --------------------
Is your project in D: \ wamp \ www \ file?
Confirm that D: \ wamp \ www \ file \ Uploads has full control of general users.
Check whether "archive allowed" of D: \ wamp \ www \ file \ Uploads is selected.
------ Solution --------------------

/*
File Upload
*/
Function up ()
{
Import ("@. ORG. UploadFile ");
$ Upload = new UploadFile ();
$ Upload-> maxSize = 10*500*1024;
$ Upload-> thumb = false;
$ Upload-> autoSub = true;
$ Upload-> hashLevel = 2;
$ Upload-> subType = "date ";
$ Upload-> dateFormat = "Ymd ";
$ Upload-> saveRule = "uniqid ";
$ Upload-> uploadReplace = false;
$ Upload-> allowExts = explode (',', 'PNG, jpg, jpeg, gif ');
$ Upload-> savePath = C ('image _ upload ');
If ($ upload-> upload ()){
$ Info = $ upload-> getUploadFileInfo ();
// Dump ($ info); exit;
 
Return $ info;
} Else {
$ This-> error ($ upload-> getErrorMsg ());
}
}

'Image _ upload' => '/DATA/html/EMS/thumb /'
This is the path
The file cannot be uploaded, not the file itself. The permission issue is to check whether the directory you want to upload has the permission.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.