i need to upload a file doc or pdf or rich text through jquery and smarty
i try to pass the file in jquery is given below
window.location.href= sitePath+'download?p='+$('#file').val();
but the p doesn’t have value. how to get the file path or name and how can stored in server
in controller i write just pass the query to model is given below
$model=new download();
$id=$model->upload($param);
and i can’t develop the model code….
please help me
You can’t send files like that.
You should either submit a form with
enctype="multipart/form-data"or use some AJAX uploader (which uses form submit to iframe and then stores a file using PHP script).EDIT: Some references
http://www.w3schools.com/php/php_file_upload.asp – tutorial on how to upload a file using PHP
http://valums.com/ajax-upload/ – example of ajax uploader.
EDIT2: The problem is not with your model code but with the way you try to submit a file.