[eluser]predat0r[/eluser]
great, i'll check ! thx
[eluser]predat0r[/eluser]
Any idea how to refresh the page after upload is successful? I tried after the $result comes back, in the controller, but it seems the flow stops in the fileuploader.js
[eluser]SPeed_FANat1c[/eluser]
you might refresh the page with javascript. After file upload there is callback function in valums ajax uploads script, so you can put the refresh code in it.
Here I found something about refresh with [removed]
http://stackoverflow.com/questions/25574...ing-jquery
[eluser]predat0r[/eluser]
thanks, reading..
[quote author="SPeed_FANat1c" date="1306601891"]you might refresh the page with javascript. After file upload there is callback function in valums ajax uploads script, so you can put the refresh code in it.
Here I found something about refresh with [removed]
http://stackoverflow.com/questions/25574...ing-jquery[/quote]
[eluser]mabright[/eluser]
seibelj, I am trying to get my upload working based on you instructions. I am receiving a "Failed" message. I select a file, I see the loading image and the file name and size, then "Failed".
Controller
Code: public function upload()
{
$this->load->library('qquploadedfilexhr');
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = array('jpg','bmp','png','gif');
// max file size in bytes
$sizeLimit = 1 * 1024 * 1024;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload('../../img/uploads');
// to pass data through iframe you will need to encode all html tags
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
}
upload.js
Code: $(document).ready(function() {
var uploader = new qq.FileUploader({
// pass the dom node (ex. $(selector)[0] for jQuery users)
element: document.getElementById('file-uploader'),
// path to server-side upload script
action: 'http://www.mysite.com/ajax/upload'
});
});
View
Code: <div id="file-uploader">
<?php
echo (isset($error))? $error : '';
$attributes = array('id' => 'imageform');
echo form_open_multipart('ajax/upload', $attributes);
?>
<p><strong>Upload a Picture</strong></p>
<input type="file" name="photoimg" id="photoimg" size="25"/><br>
</form>
</div>
[eluser]mabright[/eluser]
Anyone?
[eluser]bluepicaso[/eluser]
[quote author="mabright" date="1327620436"]seibelj, I am trying to get my upload working based on you instructions. I am receiving a "Failed" message. I select a file, I see the loading image and the file name and size, then "Failed".
Controller
Code: public function upload()
{
$this->load->library('qquploadedfilexhr');
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = array('jpg','bmp','png','gif');
// max file size in bytes
$sizeLimit = 1 * 1024 * 1024;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload('../../img/uploads');
// to pass data through iframe you will need to encode all html tags
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
}
upload.js
Code: $(document).ready(function() {
var uploader = new qq.FileUploader({
// pass the dom node (ex. $(selector)[0] for jQuery users)
element: document.getElementById('file-uploader'),
// path to server-side upload script
action: 'http://www.mysite.com/ajax/upload'
});
});
View
Code: <div id="file-uploader">
<?php
echo (isset($error))? $error : '';
$attributes = array('id' => 'imageform');
echo form_open_multipart('ajax/upload', $attributes);
?>
<p><strong>Upload a Picture</strong></p>
<input type="file" name="photoimg" id="photoimg" size="25"/><br>
</form>
</div>
[/quote]
check you path
Code: $result = $uploader->handleUpload('../../img/uploads');
//- be aware it automatically takes path from your PROJECT FOLDER
/* example as if i have my project as '/var/www/PROJECT' with the upload folder as
'/var/www/project/UPLOADS'. so the path should be
*/
$result = $uploader->handleUpload('uploads');
[eluser]mabright[/eluser]
Bluepicaso,
I previously changed my upload path to ./img/uploads and I no longer received an "unwritable path error". The error I am receiving now is:
[10:15:09.748] [uploader] responseText = {"error":"No files were uploaded."} @ http://mysite.com/js/fileuploader.js:
Line 873 of fileuploader.js is:
Code: if (this._options.debug && window.console) console.log('[uploader] ' + str);
[eluser]bluepicaso[/eluser]
download my js file here
http://www.thecodingbox.com/lab/resumegu...ploader.js
code that i use for upload button
Code: function createUploader(){
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader-demo1'),
action: '<?=base_url()?>insert/addImage',// below is the code for this contoller function
multiple: false,
debug: false,
allowedExtensions: ['jpg', 'png', 'gif'],
onComplete: function(id, fileName, responseJSON){
if(responseJSON.success == true)
{
newFile = responseJSON.fileName
growl('Processing Image Please Wait');
createThumbnail(newFile, <?=$userId?>, "<?=$userDetails[0]['userImage']?>");// thats another function to create thumbnail
jQuery('#uploader').fadeOut();// i hide it since i dont what user to upload again
jQuery('.qq-upload-list').empty();
}
else{
growl(responseJSON.error);
}
},
showMessage: function(message){
}
});
}
controller function
Code: function addImage() {
$uploadpath = 'uploads/profileImages/';
$this->load->library('qquploadedfilexhr');
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = array('jpg', 'png', 'jpeg', 'gif');
// max file size in bytes
$sizeLimit = 1 * 1024 * 1024;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload($uploadpath);
// to pass data through iframe you will need to encode all html tags
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
}
|