How to upload file by HTML only - html

<form action="upload.html" method="post" enctype="multipart/form-data">
<input type="file" />
<input type="submit" value="Upload" />
</form>
I saved this file as main.html
I made a dir called 'images' with chmod 777
what should be in the file called 'upload.html' ??
I don't want to use any php or asp files
just html files, so how can I do it by html files only ?

Client Side (Browser) => Web Server => Script => Server Manipulation
You CANNOT just use HTML files to upload to the server.
Web servers do serve static content (think 'GET') however
when it comes todynamic webpages or the ability for the client (browser)
to POST/PATCH content on the server you would need some sort
of script for that!
Choose perl, php, ruby, python, javascript, or whatever makes
you smile, and put that behind your webserver, with the appropriate
image uploading logic and you're good to upload pictures directly
to your server then :)

It's simple. You can't.
Call, main.php and have that contain code shown here to upload files to your server. It is fairly simple to do.

Your still going to need to use PHP/ASP somewhere. It's easier to utilize a single PHP file, but if you wanted your end users just to see an .html file instead, you could have it post to a php script file (but it must be a .php extension for the server to execute it).
As mentioned earlier, have a look at the W3 Schools post on PHP file uploading.

The simplest answer is no , you cant do it with the help of html . You need to use php or any server side language to handle file upload .
See this link : W3schools php file upload
Or you can use any other server side languages like asp , python , jsp etc...
An another possiblility is you can use javascript (client side) . Use javascript with ajax ..
See this link Click here

Related

Is it possible send a specified file (input type=file)?

I need to upload a file repeatedly by browser (automatic) and refresh time ask me for confirm.
How can i to POST form with a specified file?
Sorry my english
It would be nice if you make available what you already tried, then we know where you are getting stuck.
Basically if you need to upload a file to a remote server you will need a dynamic language like PHP, Python, etc.
You can't send files to a remote server using plain HTML.
For security reasons HTML itself won't let you send files to a remote webserver via <form> automatically.
For that feature you would have to have your webserver handle the form via a special file like for example <form action="exampleFormHandler.php" method="post">.
Placed at your webserver, this form-handling file would have to provide the sending of that very file then.

Can I have a link automatically download a file in an email?

I have an email with a link to a video file stored on a cloud hosting service (backblaze)
I'm trying to make it so that when someone can clicks the link the file would start to download. Right now I have this:
Download Here
That takes you to the video instead of downloading the file. I'd like to avoid that if possible and have the link prompt you to start downloading the file when you click on it.
Is this possible to do in an email when the file is stored on a server somewhere?
Thanks
I think you can't do this in plain html.
Since you can't use JavaScript in email, the best option would be to manage to include some PHP script in the server that do the job.
This example was taken from serverfault
PHP
?php
// We'll be outputting a MP4
header('Content-type: video/mp4');
// It will be called downloaded.mp4
header('Content-Disposition: attachment; filename="downloaded.mp4"');
// Add your file source here
readfile('original.mp4');
?>

Use json file only client side in meteor

I have a json file with information scrapped dayly from the web and as it's just a small array I decided to put it in a file in the public folder and read it client side. The array will be used as the options for a select tag.
I would like to read it only client side without pinging the server. How can I read the file in a template helper?
As I'm new to web development the file client side solution was the one I thought was best. If you believe there's a better way please state it and explain why is better. Thanks
You can use the http package to make a httprequest to the 'public' folder.
HTTP.get("yourweb/yourfile.json",{},function(error,result){
//do something with result
});
https://docs.meteor.com/api/http.html

How can HTML page be populated with values from ini file

On a webserver when I get a request to serve page index.html. How can I send certain values from an an ini file.
For example, index.html on server contains
<input type="number" name="userChunkSize" value="1024">
Here, I don't want to send the value statically harcoded in index.html, but instead this value should be read from an ini file having the below lines, located at the same place in server as index.html
[index.html]
value=2048
After reading the ini file the final index.html returned should be
<input type="number" name="userChunkSize" value="2048">
Any suggestions on how a better architecture can be done would also be greatly appreciated
It is highly unusual to use an .ini file for such a purpose. Values that need to be generated dynamically should be created using a server side language such as php, asp, python, etc... Then your 2048 could be loaded from a server side .ini file (not a great idea), or preferably from a database.

read and write a text file locally using chromium

I am running a web application from a local folder using Chromium.
Let's say I have my application contained in the following folder:
C:/Myfolder/App
I also know how to read a text file using the HTML5 APIs using a
<input type="file" name="files" id="fileElem" />
now I would like to know if I can read the file without the user having to select the file I am trying to read. The file is always contained in the following folder:
C:/Myfolder/App/Files
a subfolder of the folder containing the HTML that defines my application so there will not be any security restrictions and the file is always run through chromium locally. The file I am trying to read is a text file. Can I also modify and write the file in the same location? If yes would you be so kind to provide some example code?
Thank you very much,
Set TChromium.Options.FileAccessFromFileUrls to STATE_ENABLED and then you can use your normal AJAX functions on file://-Urls.
If you are using jQuery, you could use this code:
$.get('file:///c:/Myfolder/App/files/content.xml',function(data){
console.log(data);
})