Any ideas how to create a very basic file upload progress?
It just needs to show the percentage of the file uploaded.
I've been seeing codes and plugins, but it looks very complex. I just want to try it out using WebForms to get the basics of it.
Server-side is irrelevant, it's done entirely client-side.
The simplest method is available pre-packaged for you, found with just a little bit of googling, here: http://blueimp.github.com/jQuery-File-Upload/
Related
I'm building a website (no CMS or framework) that needs a contact form with a file uploader. I've already written a PHP script for a standalone contact form, but I'm not sure how to go about connecting it with a file uploader that will store the files on the server and will also work on mobile devices.
Since I'm not very experienced in this topic, my questions are:
Would this be too difficult to manually write and implement?
Are there any existing solutions I can use?
Considering the website is almost done (structure/design have been built), should I switch to WordPress and use a plugin? I got 3/4 into converting the HTML into a theme, but I'd really prefer to continue this way
Any advice would be greatly appreciated. Thanks!
Uploading files without a framework is made quite easy with w3's guide:
http://www.w3schools.com/php/php_file_upload.asp
I'm working with a client that has a view that, after a user logs in, this view loads a template, that dynamically draws a canvas with jQuery, and generates an image copy of the canvas.
They want to protect the jQuery code, hiding the process in the python code.
I tried using PyExecJS, but it doesn't support jQuery, since there is no DOM.
I've also tried urllib2, mechanize and Selenium, but none worked.
Is there an alternative or have I missed something?
Update/Resolution: In case someone stumbles onto this question: I ended up using Selenium for Python to load the JS function, fed it the necessary data and extracted the image from it. It has a bit of an overhead, but since the main goal was to keep the JS code obfuscated, it worked.
If I understand correctly, you are trying to hide jquery code.
You can't hide jquery code from the user, because django processes python code before it serves up the template, there's no way to protect jquery code with python. Really the best thing you can do is to minimize and obfuscate the code, but that only makes it difficult for human reading.
I have a script already for uploading pictures, but I want the ability to select more pictures at once on upload,by holding down ctrl,I know I can use uploadify but I don't want to start over, mabe you guys know a script or something for jquery, that will work without to remove the current code, or you guys could give me a snippet.
The ability to slect multiple files in entirely the browsers features. Which cannot be changed by using a Javascript or css or html. Using uploadify or similar as you mentioned in your question is the right way to go.
You know uploadify also uses the swfobject.js, to overcome this limitation by using an actionscript instead.
You could write your own upload system in javascript with ajax. See http://www.html5rocks.com/en/tutorials/file/dndfiles/
Basic workflow
get local file contents
push to server via ajax
With this you could do a multi-file select and/or drag and drop upload system. Best and maybe only solution if you want to stay in javascript.
I believe that this question has been asked in a few different forms, but I've read quite a few different responses.
At first, I had a web-application written with mostly jQuery that would make use of servlets to retrieve information from various locations JavaScript could not access (ie. Feeds, images from a server, etc.). Now, however, I've been told to do away with the servlets and application configuration classes so that this project of mine contains only HTML, CSS, and JavaScript/jQuery. Rather than pulling the images off of the server, I need to retrieve them from a local file on the computer. I know that allowing this might seem like terrible design, but it's what I've been asked to do. At any rate, what I really need to do is count the number of image files in a directory and then perhaps compile an array of the filenames themselves. I could do this fine in Java when using the servlets, but without them, I'm not sure how or even if this can be done.
I'm basically trying to use the jQuery Cycle plug-in to cycle through these images like a slideshow. I inject (or $("#div").append()) these images into the div by using a loop based on the number of images present.
So, is there a way I can do this with using JavaScript, HTML, jQuery plug-in, etc? I'd like to avoid using PHP and Java at this point...
You can't just read a directory with JavaScript; however, there appears to be a way to "exploit" how browsers function using http://www.irt.org/articles/js014/. It may not be pretty, but the demo works in the latest Chrome and IE7-9 for me. I'm sure some of the techniques could be updated to use cleaner code if you'd like to improve upon it.
EDIT:
Another technique you could use can be found in Javascript read files in folder
It definitely looks to be a cleaner solution. What I'd recommend is extracting the body contents to inject into a hidden div or using the path for an iframe that you can read from.
So guys I am working on a program to like download stuff using javascript. I hav written the following code:
function download()
{
alert("Hello");
var url='http://somesite/somefile.rar';
window.open(url,'Download');
}
The code is pretty easy, but is there some other way to download the file using javascript? Also having downloaded the file is there some way to store it locally in the location of our choice, like d-drive? I had come across the javascript file api while searching the web, is it any useful in my scenario? Please help.
Edit: Fixed code formatting
No, this isn't possible. It is up to the client where to save files, not you.
Through Javascript, you can only set the file name that you want, but would not be able to access the file system i.e. All the folders, etc..