interfacing php with matlab -
i have html file test.html
<form enctype="multipart/form-data" action="computesift.php" method="post"> <input type="hidden" name="max_file_size" value="10000000" /> choose file upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="upload file" /> </form>
the above code when run calls computesift.php file inturn calls matlab processing on input image
//computesift.php <?php #function streaming file client function streamfile($location, $filename, $mimetype='application/octet- stream') { if(!file_exists($location)) { header ("http/1.0 404 not found"); return; } $size=filesize($location); $time=date('r',filemtime($location)); #html response header header('content-description: file transfer'); header("content-type: $mimetype"); header('cache-control: public, must-revalidate, max-age=0'); header('pragma: no-cache'); header('accept-ranges: bytes'); header('content-length:'.($size)); header("content-disposition: inline; filename=$filename"); header("content-transfer-encoding: binary\n"); header("last-modified: $time"); header('connection: close'); ob_clean(); flush(); readfile($location); } #main script #<1>set target path storing photo uploads on server $photo_upload_path = "c:/wamp/www/upload/"; $photo_upload_path = $photo_upload_path. basename( $_files['uploadedfile'] ['name']); #<2>set target path storing result on server $processed_photo_output_path = "c:/wamp/www/output/processed_"; $processed_photo_output_path = $processed_photo_output_path. basename( $_files['uploadedfile']['name']); $downloadfilename = 'processed_' . basename( $_files['uploadedfile']['name']); #<3>modify maximum allowable file size 10mb , timeout 300s ini_set('upload_max_filesize', '10m'); ini_set('post_max_size', '10m'); ini_set('max_input_time', 300); ini_set('max_execution_time', 300); #<4>get , stored uploaded photos on server if(copy($_files['uploadedfile']['tmp_name'], $photo_upload_path)) { #<5> execute matlab image processing algorithm #example: compute , display sift features using vlfeat , matlab $command = "matlab -nojvm -nodesktop -nodisplay -r \"computesift('$photo_upload_path','$processed_photo_output_path');exit\""; exec($command); #<6>stream processed photo client streamfile($processed_photo_output_path, $downloadfilename,"application/octet-stream"); } else{ echo "there error uploading file $photo_upload_path !"; } ?>
.when html code tun in browser allows user select file , upload on server..however when php script called doesnt call matlab processing.the matlab supposed take input image , compute sift of image.it takes lot of time , doesnt show result. there way know if matlab actualy being called or no?? referred following tutorial doesnt work properly.can nyone tel me m going wrong.any appreciated.
link tutorial referred http://web.stanford.edu/class/ee368/android/tutorial-3-server-client-communication-for-android.pdf
the contents of output.log file when trying run matlab program throgh php commands follows
warning: unable locate personal folder $documents\matlab warning: userpath must absolute path , must exist on disk. exception in thread "filedecorationcache request queue" java.lang.runtimeexception: java.io.ioexception: not shell folder id list @ sun.awt.shell.win32shellfoldermanager2$cominvoker.invoke(unknown source) @ sun.awt.shell.win32shellfolder2.getfilesystempath(unknown source) @ sun.awt.shell.win32shellfolder2.composepathforcsidl(unknown source) @ sun.awt.shell.win32shellfolder2.<init>(unknown source) @ sun.awt.shell.win32shellfoldermanager2.getdesktop(unknown source) @ sun.awt.shell.win32shellfoldermanager2.createshellfolder(unknown source) @ sun.awt.shell.shellfolder.getshellfolder(unknown source) @ com.mathworks.jmi.mlfileiconutils.getnativefileicon(mlfileiconutils.java:235) @ com.mathworks.jmi.mlfileiconutils.getfileicon(mlfileiconutils.java:102) @ com.mathworks.mlwidgets.explorer.extensions.basic.defaultfileinfoprovider$1.run(defaultfileinfoprovider.java:64) @ com.mathworks.mlwidgets.explorer.model.filedecorationmodel$3$1.run(filedecorationmodel.java:344) @ com.mathworks.util.requestqueue.execute(requestqueue.java:105) @ com.mathworks.util.requestqueue.access$000(requestqueue.java:22) @ com.mathworks.util.requestqueue$2.run(requestqueue.java:75) @ java.lang.thread.run(unknown source) caused by: java.io.ioexception: not shell folder id list @ sun.awt.shell.win32shellfolder2.getfilesystempath0(native method) @ sun.awt.shell.win32shellfolder2.access$900(unknown source) @ sun.awt.shell.win32shellfolder2$8.call(unknown source) @ sun.awt.shell.win32shellfolder2$8.call(unknown source) @ java.util.concurrent.futuretask$sync.innerrun(unknown source) @ java.util.concurrent.futuretask.run(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.runtask(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ sun.awt.shell.win32shellfoldermanager2$cominvoker$3.run(unknown source) ... 1 more {undefined function 'computesift' input arguments of type 'char'. }
Comments
Post a Comment