I was wondering what the html code was to let users upload their images to my html webpage, I looked at https://www.w3schools.com/php/php_file_upload.asp but when i enter it, it does not work, so if anyone has a code, preferably without a php file required, please share it with me. Thx!
In order for users to be able to upload images to your website, there needs to be a place for those images to be placed. This is the role of the your server. In the example above, they are using a php server to keep track of the image that was uploaded, and serve it back to the user when requested. So, while you may have followed the code in the example, without a server, users cannot upload anything to your site.
Related
I was wondering how I could upload a picture on js fiddle in one of my divs.
I tried to save an image to my files and i tried to pull the image from my files yet my code could not recognize the file name.
Perhaps some of these earlier comments might help (one person clarifies how to load your own images at JSF):
Stackoverflow post
JSfiddle Docs
Some other external image services examples (there are plenty out there):
Placeholder.com
Unsplash via their free images
Another possible way to upload your images is via PostImage which will host it free there, then you can link it onto your web page.
PostImage
I've recently started learning html and for my first project i'm trying to create an image gallery that takes every png file from a directory and frames them on one page.
I've managed to make a very simple gallery that displays the images in a grid pattern but i haven't been able to make it take images straight from a folder without doing it manually.
I'm probably getting ahead of myself with such a project but any help is welcomed.
Current code is on github here:
http://ronsoros.github.io/?f49ef4d23d14e2c204648514729a7d850f62cf13
Welcome to Stackoverflow and the world of web development. You're indeed getting a little ahead of yourself, but that's a great attitude.
To be able to fetch all the images from a folder automatically, you need a programming language. Javascript is one of those programming languages, but Javascript is client side.
Client side means that the code you've written is executed by the users' browser. This means that as long as the user has access to the folder with your images he/she is able to fetch all the images and display them on the webpage. Most servers, the computer your website is hosted on, take security measures to make sure that the user can't access a directory, only the contents. This means that the user cannot know how many images are in the directory.
Javascript is also very slow in doing this, as first the page needs to load; run the javascript; loop over every image in a directory; display them one by one; end the script.
So what you need is PHP, a serverside language. This will be run before the user gets the page, the server executes the code. This means that you have access to the folder containing the images and are able to loop over them, get the images and put them in HTML tags to send to the user with the page.
But PHP needs a lot more than just a .html file, it needs a .php file and your computer or server has to know about PHP and what to do with it.
If you want to learn more about PHP W3Schools has a great guide on the basics of PHP: https://www.w3schools.com/php/
But I recommend sticking with HTML and CSS right now and really try to understand how it works and why it does what it does.
Goodluck!
I am trying to edit the following page: http://tktruck.com/contact.aspx in order to get rid of the cat photos.
Apparently there is no contact.aspx file in the FTP, so I am having trouble figuring out how to edit this page's content.
Some additional information:
I have access to the back-end (FTP files). I have searched the FTP for contact.aspx, and I cannot find the file. I have tried searching the entire website for tags with the appropriate sources, as well. I found some code with the image tags, and removed those tags. When I uploaded the code to the server, the images were still there (and still are).
Does anyone know what I have to do to edit an aspx file, or at least have an idea on how to remove these photos?
You need to get access to the server in which the website is hosted.
I only know CSS and HTML. I have to create a web page with an account opening form. My faculty had told me to make it at that so I built it. He asked me not to host it.
Now he is asking me to take everyone response and create a database. I could do that by sending the webpage to everyone and asking them to download the page locally in their system and then open and fill the form. But I do not know how to save that data. If I could get the output in a text file it will be time saving, but even if the page retains the information while my classmates send it back to me it will be great. Can anyone help me on how to save the data?
I know creating a word file would have been much easier but he wanted web page so I am stuck.
You cannot do this with only HTML and CSS. To do this, you would have to code a server-sided page so that you can serve HTML pages to your users, as well as receive data back from them.
Is there a way to disable a user from downloading a file from a URL?
For example I have a link:
wow.mywebsitedomain.com/templates/filename.svg
I want to disable the user from downloading the filename.svg
These svg files are not just an image, they are editable designs that I have spent countless hours on each. No, I do not care if someone does a screenprint or gets a png etc, as those are not scalable, editable, vector files.
When the user clicks on a png thumbnail my actual link opens my online design editor to allow the user to customize these files, then save to my server, then purchase printed media, and they are not allowed to download any files.
I tried putting the actual files into a password protected folder on my server, but they do not open properly, and I do not want the user to have password access to this folder.
Essentially I need the link to be accessible, just not show the actual link for someone to copy and open/save/download etc.
Hopefully there is a simple solution for a non-programmer with basic html skills?
Thanks
Your can do things like "disabling right-click" and stuff - it may prevent some users from downloading your file, BUT basically you cannot prevent a file which is downloaded and interpreted by the browser from being downloaded to a user's hard drive.
This is not only true for SVGs, but also for music, videos, etc.
Instead, you can convert your SVG file to a PNG on server-side, and show only the PNG to the user. Note that you have the possibility to create PNGs of different sizes on the fly - dependent on the request, user's screen resolution, etc. You can also implement caching of the generated PNGs if needed.
On how to create a PNG from SVG in PHP read here:
Convert SVG image to PNG with PHP
You can choose other raster image format, of course.
If they can view it, they can download it. End of story. If you only want them to see a PNG, make a PNG from it and put that up
My understanding is; if you can see it, you can download it,