Saturday 15 March 2014

php - How to check if file (image) upload is completed -



php - How to check if file (image) upload is completed -

my scenario, user posting info , image via android device on server. script handles upload wait response until image uploaded 100%.

actually it's not clear me, since i'm still beginner, if script already. when posting item via android, receive response pretty fast , image between 1 , 2mb.

this script i'm using now:

<?php /************************************************ required php files ************************************************/ require_once("../models/funcs.php"); require_once("../models/db-settings.php"); /************************************************ functionality ************************************************/ $image_path = "../images/items/"; $image_name = $_files['uploaded_file']['name']; $user_id = $_post['user_id']; $query = ... $result = $my_db->query($query); $image_path = $image_path . basename( $_files['uploaded_file']['name']); if(move_uploaded_file($_files['uploaded_file']['tmp_name'], $image_path) && !$my_db->error) { echo 200; } else{ echo 400; echo $my_db->error; echo "there error uploading file, please seek again!"; echo "filename: " . basename( $_files['uploaded_file']['name']); echo "target_path: " .$target_path1; } ?>

this how php has worked. script run 1 time upload finished.

only it's possible monitor file upload progress.

php

No comments:

Post a Comment