Copy a image from a remote server via jquery or javascript - javascript

anyone knows a way how i can copy a image from a remote server in a local directory via jQuery or JavaScript?
via php copy or cURL its not allowed on my webspace.
best regards

Related

Run a script in a google cloud from a local html page

I would like to run a script in a google cloud server using a local HTML page.
To be more clear the steps would be:
open a local HTML page on my local computer.
push a button that triggers a script in my google cloud server.
the script creates a file in the server that I can download pressing
another button.
I'm new in this field and I don't know where to start.
How do I connect to the server via HTML? (PHP?, Javascript?)
How does the authorization process work?
There are several languages and strategies that you can use.
You can use locally Javascript or PHP (it needs installation and configuration) that will allow you, for example, to make an HTTP request (it may also be another protocol), to a script (that can be in PHP or Javascript or others) on the server, which, upon receiving the request, processes and generates a file for a specific path.
Then on that other button you make a request to that path to download the file.
My suggestion is to choose the languages and implement with these to understand the process.
Create an HTML page, put a button.
Attach a function to button onClick to send an Ajax request
That would cause cross server request challenge for you down the road..
You can simply put a URL from your local web page styled as a button to your Google Cloud hosted application.
Create the file on the server side and you can set an HTML header
Content-Disposition: attachment; filename="results.csv"
to make a file downloaded to the user end.

How can I convert a file (pdf/doc) served at a url into json / string / base64 format without downloading on local?

Let's say a pdf document is served at a url, ex - https://www.polyu.edu.hk/iaee/files/pdf-sample.pdf
I need to run a javascript that takes the url and makes a post request to a server with the pdf file data that can be converted back to file. Typical solutions for accessing files on a server location are around downloading on local first and then having the user upload it. How can we bypass the user interference ? Appreciate all inputs and workarounds like using browser cache / local storage etc.
Thanks
This is not possible.
JavaScript executed in a browser runs on the client machine. Thus any modification on a remote resource must be downloaded, modified and uploaded to the server.
As you already stated: using a browser cache or local storage wont help you.
You have to do this modifications on server-side e.g. with a servlet or php. You will need access to the server.

save image from remote server to local using javascript or jquery

I wanted to copy image from any remote server to my local server using javascript / jQuery. Please anyone help me out.
Same like copy() function in php.
Local server? JavaScript/Jquery runs in the client and they cannot access any files directly from a remote server. The client are mostly your browsers.
If you know the file path for your remote server and if your have access to it, you can just open the file using window.open("http://remoteserver/filename.jpg")
This would download the file to the client or your computer.

How to ftp a file over to a server from PhoneGap/webapp?

Is it possible to connect to a server and FTP a file from within PhoneGap application? Basically I suppose - is there a way to open an FTP connection with Ajax/JQuery somehow?
I don't think you will be able to FTP a file from PhoneGap however they do provide an API for transferring a file to a server using HTTP multipart encoding:
http://docs.phonegap.com/en/1.0.0/phonegap_file_file.md.html#FileTransfer
You would need a script on the server in your chosen technology to receive the file however you should then be able to do whatever you like with it, including move it to the directory you are trying to FTP to
Ftp program for phone gap is here please see this bellow link.
https://github.com/macdonst/FtpClient

Javascript Get Page Source (server-side)

Is it possible to get the source of a server-side page from a javascript script? I want to be able to get the source of a page that is in the same folder on the server. Is it possible without using anything other than javascript?
If you want to get the result of the execution of some server side script (often HTML) from javascript you could use AJAX.
If you want to get the source code of some server side script using javascript (such as the C#, Java, PHP, ... code), you can forget about it unless you publish this source code as text file so that the server doesn't try to interpret it and then use AJAX to fetch this text file from javascript. Of course anyone will be able to access it, not only javascript hosted on your site.

Categories

Resources