Public function upload () {//import Picture upload class import ("ORG.Net.UploadFile"); Instantiate the Upload class $upload = new UploadFile (); $upload->maxsize = 3145728; Set file upload type $upload->allowexts = array (' jpg ', ' gif ', ' PNG ', ' jpeg '); Set File upload location $upload->savepath = __root__. ' /public/uploads/images/'; Set the file upload name (by time) $upload->saverule = "Times"; if (! $upload->upload ()) {$this->error ($upload->geterrormsg ()); }else{//Upload successful, get upload information $info = $upload->getuploadfileinfo (); } $savename = $info [0][' Savename ']; $url = $savename; Save the form data, including the uploaded picture $model = M ("Pkxs"); if (false = = = $model->create ()) {$this->error ($model->geterror ()); }//Update data $list = $model->save (); if (false!== $list) {//successful prompt $this->assign (' Jumpurl ', Cookie::get (' _currenturl_ ')); $this->success (' Editorial success! '); } else {//error prompt $this->error (' Edit failed! '); } }
The directory in the code is there, I also have the entire "uploads" folder and subfolders in IIS "write" permission, why or Prompt "upload directory/web/wpm/public/uploads/images/not writable"?
Reply to discussion (solution)
Is your upload directory on the website?
If yes, you need to check "write" in IIS Admin
From the root to your upload directory, the path name cannot have Chinese
The default character set for Windows is GBK, and TP is Utf-8
It is not sufficient to have write access to a folder that is not managed by IIS, and you need to check the Allow archive in the Advanced tab
Is your upload directory on the website?
If yes, you need to check "write" in IIS Admin
From the root to your upload directory, the path name cannot have Chinese
The default character set for Windows is GBK, and TP is Utf-8
It is not sufficient to have write access to a folder that is not managed by IIS, and you need to check the Allow archive in the Advanced tab
I would like to ask the moderator, I want to check my entire project directory "write"? Or do you just tick "write" The upload directory?
There is no Chinese path.
IIS is configured for the entire Web site.
I found the reason, not the IIS configuration issue, is that the write permission of the users who uploaded the directory folder is not given.
Or to thank the moderator! Knot stickers to points!