PHPAJAXFORM submits the image upload and displays the image source code.
PHP dofile. php file upload source code
$ File_allow_size) {$ data ['status'] = 1; $ data ['MSG '] = "the file size exceeds the limit and can only be uploaded ". sizeFormat ($ file_allow_size ). "File! ";} If ($ data ['status'] = 1) {$ data ['status'] = 1; $ data ['MSG '] = $ data ['MSG']; exit (json_encode ($ data);} if ($ data ['status'] = 0) {if (file_exists ($ file_upload) {$ file_new_name = date ("YmdHis "). '_'. rand (Random, 99999 ). '. '. $ file_ext; $ file_save_path = $ file_upload. $ file_new_name; $ data ['status'] = 0; $ data ['URL'] = $ file_save_path; move_uploaded_file ($ file_tmp_name, $ file_save_path); exit (json_encode ($ Data);} else {exit (json_encode ($ data) ;}}} function sizeFormat ($ size) {$ sizeStr = ''; if ($ size <1024) {return $ size. "bytes";} else if ($ size <(1024*1024) {$ size = round ($ size/, 1); return $ size. "KB";} else if ($ size <(1024*1024*1024) {$ size = round ($ size/(1024*1024), 1 ); return $ size. "MB";} else {$ size = round ($ size/(1024*1024*1024), 1); return $ size. "GB" ;}}?>
The HTML is as follows: