Getting uploadify to work |
[eluser]akzidenz[/eluser]
Hi there I've been told by my host that uploadify.php is insecure... We were using this method - http://www.reloadedpc.com/code-igniter/j...deigniter/ Here's a snippet of our logs: "GET /js/uploadify/uploadify.php HTTP/1.1" 200 13 "-" "Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.5.24 Version/10.53" "GET /favicon.ico HTTP/1.1" 200 1406 "xxx/js/uploadify/uploadify.php" "Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.5.24 Version/10.53" "POST /js/uploadify/uploadify.php HTTP/1.1" 200 181 "-" "Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.5.24 Version/10.53" "GET /images/rm.php HTTP/1.1" 401 74 "-" "Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.5.24 Version/10.53" etc etc Just a word of warning!..
[eluser]pickupman[/eluser]
Thanks for the heads up. However, the purpose of my code is to provide a functioning demo. Providing too much security may prevent someone to figure out how the whole thing works. You are probably going to need to check where the request is coming from in upload.php.
[eluser]tim1965[/eluser]
Hi I have a couple of questions in regards to pickupmans example. I can get it to work and upload correctly, however i have a couple of questions (apologies in advance if they are stupid). I want to use uploadify to handle large video uploads, which requires using ffmpeg as part of the conversion process. This can take up to a minute to convert an individual file, however uploadify displays 100% complete from your example once the file has been uploaded i.e. upload.php has executed, but ffmpeg is still executing in the controller. Currently i am calling ffmpeg in a controller called after upload.php has been run. The reason i am doing it this way is because i need to move the file again and run some checks using ci functions and couldnt get them to run from upload.php. So my question is, do i need to move all of my processing to upload.php in order to get the ffmpeg conversion as part of the 100% complete. If so how so i call functions in models, echo errors, etc. If what i am doing is correct how do i return a success message from the controller and remove it from the upload.php Apoligies again if these are stupid questions, but i have zip experience with jquery, and json. Thanks in advence
[eluser]pickupman[/eluser]
@tim1965 My example will echo back a json string of the upload data. You can use this json string and shown in the code using onComplete event. Once upload.php has completed the upload the file will be stored in /uploads(default), and then use CI to manipulate it. For example, I am using it on an internal app here in the office, where I upload a CSV file, take the json string returned, in the onComplete callback I use $.post(), and send another ajax request with some user data for auth info, and then use mysql load csv command, and import into database.
[eluser]tim1965[/eluser]
pickupman Many thanks for your response. I have got your example code working correctly, and is uploading correctly. I can also manipualte the data correclty using my controller after the upload.php has finished executing. However what i think is happening is that the flash progress bar is only linked to the upload.php in your code for example. This means i think that the progress bar shows 100% on comletion of executing the code in upload.php. If i therefore run my controller after the physical upload has finished i may still have a further 1-2 minutes to convert the video file to a .flv file using a call to program ffmpeg. So my issue is how to ensure the progress bar includes both the executing of the code in upload.php and the controller code before showing 100% complete. Otherwise the user may start another upload before the controller has returned any errors or success , which i dont want. So is there any way in can control the progress bar from the controller or keep the browse button blanked out until i can return the json array success or error message after my ffmpeg has finished converting. Many thanks again for your time.
[eluser]pickupman[/eluser]
I don't know if that is even possible. I take a look at another method once to see what I can find out. The progress bar is provide the user a visual representation of your file upload. Perhaps adding a file processing queue using jquery's ui might make sense.
[eluser]tim1965[/eluser]
Ok thanks i appreciate any time you could give to this. Its funny but given the amount of video uploading there is i would have thought that this would have been an issue for other people. Anyway thanks again for your help and look forward to your investigations.
[eluser]tim1965[/eluser]
pickupman I have been playing around with this today. I think the solution to my problem is relatively easy, and i am not sure why i didnt think of it before. The answer i think is to redirect to another controller after the upload and then load a view saying the file is being processed (which stops multiple uploads and queueing of conversions), this can also handle any error handling. once the conversion is complete i redirect back to your view.php in your example. However your view.php always stays resident on the screen even after a redirect and loading of a new view. Any ideas why ? Apologies but i really am only a php sql grunt, so not good at anything out side of those environments. Appreciate any pointers you can give.
[eluser]tim1965[/eluser]
pickupman lOoks like prob solved currently. Have used the OnAllComplete location.href event running after onComplete to redirect to another controller, which loads a view telleng the user the video is being converted and then reloads the view.php to allow them to upload another video. Sorry for being stupid this way of doing it should have occurred to me earlier. Will post my code once it is finished. Thnx for your response and i hope you only spent a little time on this. |
Welcome Guest, Not a member yet? Register Sign In |