php - Ajax image upload 403 error -


i have summernote implemented on site , trying use ajax call handle image upload. code using have taken stackoverflow post , works other people , have changed urls. following error:

get http://intranet-dev/dev/rehan/projecttracker/%3cbr%20/%3e%3cb%3eparse%20err…te_doc_upload_post.php%3c/b%3e%20on%20line%20%3cb%3e23%3c/b%3e%3cbr%20/%3e 403 (forbidden) 

summernote uses this:

        onimageupload: function(files, editor, weleditable) {         sendfile(files[0], editor, weleditable);         } 

and sendfile function makes ajax call:

function sendfile(file, editor, weleditable) {     data = new formdata();     data.append("file", file);             $.ajax({                 data: data,                 type: "post",                 //url: "/dev/rehan/projecttracker/form_summernote_doc_upload_post.php",                  url: "form_summernote_doc_upload_post.php",                 cache: false,                 contenttype: false,                 processdata: false,                 success: function(url) {                     editor.insertimage(weleditable, url);                 }             }); } 

the php posted looks this:

if ($_files['file']['name']) {         if (!$_files['file']['error']) {             $name = md5(rand(100, 200));             $ext = explode('.', $_files['file']['name']);             $filename = $name . '.' . $ext[1];             $destination = '/uploads/document/summernote/' //change directory             $location = $_files["file"]["tmp_name"];             move_uploaded_file($location, $destination);             echo 'http://intranet-dev/dev/rehan/projecttracker/uploads/document/summernote/'.$filename;//change url          }         else         {           echo  $message = 'ooops!  upload triggered following error:  '.$_files['file']['error'];         }     } 


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -