Is it possible to upload a file from a local machine to the same local machine using JavaScript and/or server technology? The scenario was I had to get a image file from local , do manipulations/ cropping and then save it on that local machine. my website is hosted in another country.
You would need to upload the file to your server, using a normal file upload. After you have performed the manipulations you would provide a link for the user to download the file.
You cannot force the download back to local storage, the user has to accept the download.
Just use ImageMagick on the file itself, most hosting servers support it.
Maybe this helps:
http://mondaybynoon.com/2007/01/22/crop-resize-with-javascript-php-and-imagemagick/
Related
I want a user to be able to download a file after entering their credentials on the webpage.
Currently I'm able to allow them download the file only if their browser has access to the hosting servers file systems. I saw this How to trigger a file download when clicking an HTML button or JavaScript.
This is what I'm doing currently:
Download
Excuse my naivety. My question is this: how do I change the path to file in:
Download
such that the user can directly download to their local machine when they don't have access to the hosting servers.
I have a JS code which should download a file and need to open that corresponding file. I'm able to download it but need a JavaScript code to open the recently downloaded file from any browser.
Answer is No.
Why :
When user download file into his local file system then downloaded file became a part of users file and as you know you can't access any file/directory from users local file system.
Alternative solution :Yes
Download file using XmlHttpRequest (AJAX) into blob object help link
Open file from saved blob object.
in above alternative solution You can also allow use to save file(download file).
Server image should be download in a local client machine in a particular path
using javascript or jquery.
Is there any way to download the image in a particular path where we cannot use server side script?
With only js and jquery it is not possible. Maybe with a browser extension it can be possible. But with js and jquery you dont have ability to write local machine.
I need to modify an XML file from browser which is at local file system and save back at same place where it has been picked from browser.
I have searched a lot in google but didn't find any solution. Please help me on this.
You can read a file from the the local file system, but browsers (and JavaScript) will not ever allow you to save back to the file system.
You have a couple of options:
1 - use cloud storage and avoid the file system all together
2 - Create your own desktop app and wrap a web browser control. Then open/save the file in your own code, and pass it to the browser control.
I'd like to use jQueryFileUpload to upload a file that is not on my computer but rather is at an external website so all I have is its URL, e.g., https://dl.dropboxusercontent.com/s/wkfr8d04dhgbd86/onarborLogo64.png.
I'm at a total loss on how to do this but I think it involves adding the file data programmatically rather than using the traditional <label for='myComputerFiles'>-based selection of files.
If this is correct, what next FileReader()?
Any thoughts would be appreciated.
You should do this on the server - it requires user intervention to download it locally, and that just seems hacky and unfriendly.
Reason? You would have to first download the file (which is an indeterminate process), and then upload it to the server. If you pass the URL to the server then it can perform the whole process in 1 action - a download (which is effectively the same as you uploading it). Also, the ability to read local files, which is what FileReader is for, does not mean you should download files to just upload them again. That's bad logic and your users will not appreciate it.
Also, Dropbox Chooser is not meant to be a way to download files. It's meant to be a replacement for downloading file, or uploading them to other servers... ...without having to worry about the complexities of implementing a file browser, authentication, or managing uploads and storage.
Since you're using S3, if there is an API call on S3 that allows you to specify a URL then that would be the most obvious thing to use. If you can't do that then you either need to download the file for the user (onto your server) and then upload the file to S3, or you're back to the original idea of downloading at the client and uploading from there. Either way, the introduction of S3 obviously adds another layer of complication, but I'd initially look at getting a URL from the client and getting that file on my server so I could do anything I wanted after that.
This previous question may be of some help in this area...
How to upload files directly to Amazon S3 from a remote server?