Php image uploading: this is the upload code if ($ _ POST [sub]) {& nbsp; $ myfile =$ _ FILES [myfile]; // Obtain the uploaded data first; & nbsp; $ name = $ myfile [name]; // Obtain the file name & nbsp; $ size = $ myfile [size]; // get the file size & do not display the php image uploaded
This is the upload code
If ($ _ POST [sub]) {
$ Myfile = $ _ FILES [myfile]; // Obtain the uploaded data first;
$ Name = $ myfile [name]; // Obtain the file name.
$ Size = $ myfile [size]; // get the file size
$ Tmp = $ myfile [tmp_name]; // get the temporary file path
$ Arr = explode (".", $ name );
$ Str = strtolower ($ arr [count ($ arr)-1]); // Get the suffix
$ NewName = date ("YmdHis"). ".". $ str;
$ Picurl = "uploadfile/". $ newName; // path to be saved in the database
Move_uploaded_file ($ _ FILES ["file"] ["tmp_name"], "../uploadfile/". $ _ FILES ["file"] ["name"]);
Mysql_query ("insert into history (title, time, picurl, content, introduct) values ('$ _ POST [title]', '$ _ POST [time]', '$ picurl',' $ _ POST [content] ',' $ _ POST [introduct] ') ");
?>
This is the display code
"Width =" 100 "height =" 100 "/>
Images are not displayed after being uploaded to the server.
------ Solution --------------------
$ Myfile = $ _ FILES [myfile]; // Obtain the uploaded data first;
Move_uploaded_file ($ _ FILES ["file"] ["tmp_name"], "../uploadfile/". $ _ FILES ["file"] ["name"]);
What is the name?
------ Solution --------------------
No value for $ row [picurl]
------ Solution --------------------
Reference:
No value for $ row [picurl]
++
------ Solution --------------------
You do not need to delete it. for example, you only need to change the file in the following sentence to myfile.
If you delete the above sentence, you have to modify line 3.4.5 in your code.
------ Solution --------------------
Are you sure you want:
1. Are you sure the image has been uploaded successfully? Can I find the uploaded image in the folder?
2. have the image information been saved to the database?
3. if neither of the above two points is correct, are the available image address paths on the server compliant with the server's url rules after uploading to the server?