Php uploads images. I have been sleepy for a long time. The problem is in the comments of the code.
Run the code first.
I don't think there is a problem with the code on html. I found a lot of cases on the Internet before writing the code. I wrote almost the same as on the Internet.
$ Ifile = $ _ FILES ['c _ photo ']; // The uploadImage ($ ifile) file uploaded from the foreground ); // call method // The method I wrote: function uploadImage ($ file) {$ filepath = "/uploads/photo/accredit/"; // after clicking upload, the folder contains no images. This folder exists. Move_uploaded_file ($ file ["tmp_name"], $ filepath. $ file ["name"]); echo $ file ["tmp_name"]; // upload a jpg image. C: \ wamp \ tmp \ php16F is returned here. tmp (this file is not found in this directory) echo $ file ["name"]; // the image name is returned here, and the image uploaded on it is the same. Echo"
"; Echo $ file ['error']; // Here 0 is returned (0 indicates that the upload is successful )}
Reply to discussion (solution)
$ Filepath = "/uploads/photo/accredit /";
This is the absolute path!
Are your images stored outside the website?
If your upload. php is in the root directory ?,? Sentence to question ??
$ Filepath = dirname (_ FILE _). "/uploads/photo/accredit/"; // after clicking upload, the folder contains no images. This folder exists.
Object ???????
Upload. php
Uploads/photo/accredit/
Is upload. php? Uploads File? Same ?. You again ??.
Thank you. I have already solved the path problem.
Let's take a look at the solution.
I often make mistakes about the path. Clearly, the code is correct, but it cannot.