This is an ajax image upload function that was used during application development yesterday. The method is very simple, which is to use js to upload the file to the iframe directly. If the file is uploaded successfully, it will return 1, and then use js to determine whether to upload it. If successful, the image will be output and the preview will be displayed.
This is an ajax image upload function that was used during application development yesterday. The method is very simple, which is to use js to upload the file to the iframe directly. If the file is uploaded successfully, it will return 1, and then use js to determine whether to upload it. If successful, the image will be output and the preview will be displayed.
ajax file upload
upload.php$destination_path = '../../upfile/jianjulogo/';//getcwd().directory_separator;
$result = 0;
$target_path = $destination_path . basename( $_files['myfile']['name']);if(@move_uploaded_file($_files['myfile']['tmp_name'], $target_path)) {
$result = 1;
}
echo $target_path;
sleep(1);
?>