Well without log works but with a litle problem now: Arquivo enviado: (null x nullpx, null)
It says all this nulls… cant see with height nor mime. I dont use it on my app but i would like to know the problem i presume the mime its because the getMimeType(); but the with and height is very strange.
thanks for all your help scoob i hope i will help you improve this extension in the future.
the information you’ve said is sent to the view by using the $return array in the controller, so it is read in the view in the callback javascript
to get the image size, in your controller you’ll have to load the file with GD library and set in the return array, like
//..use GD to get height and width...(this code you can find on Google)
//and add to the return array
$return = array(
'status' => '1',
'name' => $file->getName(),
'height'=>$height,
'width'=>$width,
'mime'=>$mime
);
or you can only ignore this by overwiting the code in your view
'onFileSuccess'=> "function(file, response) {
var json = new Hash(JSON.decode(response, true) || {});
if (json.get('status') == '1') {
file.element.addClass('file-success');
file.info.set('html', '<strong>Success</strong>'); //note i changed this line
} else {
file.element.addClass('file-failed');
file.info.set('html', '<strong>Error:</strong> (' + (json.get('error') ? (json.get('error') + ' #' + json.get('code')) : response));
}
}",
Yes but what i want to do is when you click "Remover" this go to remove the file from database and afterDelete the file will be unlinked. The problem is how to do when you click "Remover" how you do to tell javascript to delete the record or go to a action on the controller?
Hi scoob now i put my files online on a linux server and it dont work… but in my local xamp it works fine… i’m getting HTTP-status 403… i’ve changed my code to be very simple and i still get this error can you help me please, here is the code:
Controller:
public function actionUploadedFiles() {
session_id($_POST['PHPSESSID']);
session_start();
$return = array('status' => '1','name' =>'ZZZ','id_file' => 1,'mime_file' => 'image/jpeg','size'=>'192kb');
echo json_encode($return) ;
}
Going to my controller url index.php/fancy/uploadedfiles it runs just fine and prints
403 error is "Forbiden", maybe the target folder is not writeable by the webserver proccess, try changing permissions to 755 (or 777 - only for testing!!)
From fancyupload’s website:
Uploads fail with 406/403 error
From the swfupload documentation (it applies to all Flash scripts depending on FileReference):
If you are using Apache with mod_security this will not work, you need to put the following in your .htaccess file to disable mod_security:
SecFilterEngine Off SecFilterScanPOST Off
Disabling mod_security isn’t allowed on some shared hosts, and only do this if you know what you are doing. This is due to a bug in the way that flash sends the headers back to the server according to the Flash 8 documentation
Uploads fail with 403/500 error
Check your server config, there must be something wrong. Also see 404, double check the upload URL.
…let me ask you something…are you using some RBAC / srbac or filter rule in your controller?
could you please try removing the security control for testing? i think that flash isn’t retrieving the session so the action doesn’t get validated
it works when you call the url directly in your browser because the session is “alive”, it’s a php simple call
this is a problem in flash uploaders and i remember that i’ve seen a topic for this in the forum regarding another flash uploader extension…i will try to find the topic to send you
I’m pretty new to FancyUpload, but have made some good progress and have run into a roadblock.
Initially my form was a few text fields that entered into a database. This worked perfectly, auto-increment id, name, description, and story.
I now want to add the option to upload photos, so I set up a standalone FancyUpload to learn how to use it. I have it working so it was just the form and it uploaded into the proper directory.
Next step was to merge the 2 forms onto the same page, text inputs first, image attachments second. It looks great, and the image upload works when I hit submit, but this is where it gets weird.
None of the information in the text inputs gets saved/added to the database, the images upload to the specified folder, but the weird thing is that for every image I upload a blank row is added into the database that I want the text to go. For example, if I upload 5 images, I get 5 blank rows in my DB.
In general, any advice how to add FancyUpload to another form? One with text inputs, and media attachments second?
I’ve never used fancyupload inside the create form because there may have some cases when users upload some images and then cancel the new record saving, so i’d end up with images without a related record
i’d suggest two things:
1 - put the fancy upload in the view, right after the create/update
or
2 - put the code to only show fancyupload in update mode, I mean, after insert, redirect to update the same record
Personally, i’ve been using the former approach, but if someone has a better idea, suggestions will be very welcome!
You’re talking about having a 2 step submission? I could do to that, but I’d rather make that a last resort – it’d be so much cleaner if it’s possible to have them on the same page. Perhaps something like what I’ve drawn up here. Is it possible to have a form in a form? Queue up the images with 1 button, then submit the whole thing with another?
I’m not using Yii and don’t know anything about it actually, I found this thread when I searched for my problem about FancyUpload. When I have more time I’ll take a look at it, thanks.
I’m still not using Yii, but here’s an update of what I have so far. I’m not sure why it isn’t working.
When the form page loads (submit.php) there are the 3 text boxes, and the FancyUpload script. When you click submit, the FancyUpload script runs first. I edited FancyUpload2.js so the onComplete() now includes the following code:
submit_script.php is the handler for the text part of the form. That changes the action of the form, and submits it. This works perfectly. The images upload, and the text gets added to the database.
The problem is that I need the id of the submitted information from the database to move the uploaded images into the proper folder (/uploads/<id>/).
To get around this, I changed submit.php to create 1 row when you load it, and added a hidden form field (name=‘submit_id’) that holds the value of the id of the new row. I also have it create a folder called /uploads/<submit_id> (ex. /uploads/653)
Now, submit_script.php updates the row WHERE id=’$submit_id’ ($submit_id = $_POST[‘submit_id’]) instead of creating a new row. This works fine.
Previously my uploads would all go to /uploads/, so I changed those lines (in server/script.php) to read:
$Submit_Id = $_POST[‘submit_id’] just like in submit_script.php, but this doesn’t work. The uploader still uploads to /uploads/ instead of /uploads/<id>