c# - Unable to save BMP image to localhost in Winform -
my code working perfect if use jpg image not working bmp image. shows file not writable. here c# code:
string filename = @"e:\projectpics\new.bmp"; if (filename != "") { string path = "http://localhost/images/upload.php"; webclient client = new webclient(); byte[] responsebinary = client.uploadfile(path, filename); string response = encoding.utf8.getstring(responsebinary); }
here php code:
<?php //check whether folder exists if(!(file_exists('upload'))) { //create folder mkdir('upload'); //give permission folder chmod('upload/', 0777); } $uploads_dir = './upload'; //directory save file comes client application. if ($_files["file"]["error"] == upload_err_ok) { $tmp_name = $_files["file"]["tmp_name"]; $name = $_files["file"]["name"]; move_uploaded_file($tmp_name, "$uploads_dir/$name"); } else { die("upload failed error " . $_files['file']['error']); } ?>
Comments
Post a Comment