I want to save a image file to server folder and save its path to mysql -



I want to save a image file to server folder and save its path to mysql -

the problem image not moved upload_dir path, path of file inserted in server.

<?php $con=require_once("connection.php"); define('upload_dir', 'http://hpms.hostei.com/images/'); $image= $_request['image']; //byte image info received $image = str_replace('data:image/png;base64,', '', $image); $image = str_replace(' ', '+', $image); $data = base64_decode($image); $file = upload_dir . uniqid() . '.png'; $success = file_put_contents($file, $data);// print $success ? $file : 'unable save file.'; $code=0; if($r=mysql_query("insert images values('','$file')")) { $code=1; } print(json_encode($code)); mysql_close(); ?>

hi awais khan sar,

you can utilize $_files server variable. $_request used , post both method uploading images have problem , solved type. can create post method mobile device save folder using move_uploaded_file() if query tell me, hiren kubavat.

mysql

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -