How to avoid displaying "C:fakepath" in browsers [duplicate] - javascript

This question already has answers here:
How to resolve the C:\fakepath?
(13 answers)
Closed 9 years ago.
How to avoid displaying "C:fakepath" while file uploading. While uploading the file javacript method is called to set the selected path im my case

This is a browser security feature that is implemented.
According to the specifications of HTML5, a file upload control should not reveal the real local path to the file you have selected, if you manipulate its value string with JavaScript. Instead, the string that is returned by the script, which handles the file information is c:\fakepath.
If you still want to get rid of this fakepath you may check out this site
How To Get Rid of C:\FakePath in IE When Uploading A File to the Website
Hope it helps.

Related

Simplest way to store this to do list data even after browser closed? [duplicate]

This question already has answers here:
How to store objects in HTML5 localStorage/sessionStorage
(24 answers)
Storing JSON data in browser memory
(3 answers)
Closed 4 years ago.
I want to make a web-based TO-DO list exactly like the one on the W3schools link below, however when I close the browser all the inputs and edit disappear and it reverts back to the original. Is it possible to easily store the values (if not I will quickly delete this Q)? What code can I add to make it save the data (perhaps localstorage?) each time or would I have to set up a php/mySql? No authentication required, whatever is the most straightforward way to do it.
The exact code is below. I prefer to host locally for simplicty but if necessary web based hosting server is also fine with me.
To Do List Example from W3 Schools
You can use Javascript LocalStorage to save data on browser close, only if it is being loaded on a domain that is accessed via HTTP.
Though, you can use a server-side database, such as mySQL to store data.

How to pass a string which contain UTF-8 characters from javascript to PHP? [duplicate]

This question already has answers here:
UTF-8 all the way through
(13 answers)
How to store other languages (unicode) in cookies and get it back again
(1 answer)
Closed 5 years ago.
I'm building a references generator and I need to keep track of the generated references. To achieve this, I'm currently using Javascript to store a cookie containing the raw data, then a PHP page embedded on the result page takes the cookie and logs it into an HTML page, however, some characters appears like this : �. I really don't know which way to go to solve this (base64 encoding, unicode encoded characters...)
Here's the link to the website : http://louisfelixberthiaume.000webhostapp.com/source_siteweb.php
[It's in french]
I can't give you the link to the HTML page for obvious confidentiality reasons, however I'll provide a screenshot :
Generated references screenshot

How to assign the variable value to the input type "file" [duplicate]

This question already has answers here:
Dynamically set value of a file input [duplicate]
(4 answers)
Closed 8 years ago.
Hi I have small requirement, is there any way to update variable value to the input type file value (Browse).
<input type="hidden" value="Testfile - CSV - 100 rows.csv" id="filePathHdnID" name="filePathHdn" />
<input class="fileType" name="uploadfile" type="file" id="idUploadFile"/>
Here is jquery code what I tried
$("#idUploadFile").val($("#filePathHdnID").val());
Please share me your ideas, sorry if it is confused.
Looking at your requirement, you want to set a default file path for the file input control.
Unfortunately, this is a very common requirement that every client wants, but not possible using javascript because of Security Reasons.
What if possible: You as a developer can modify the file input and post it to server, and the actual user will not get notified. Any
feature/requirement of language that creates a security threat is kept closed
for developers :)
You cannot change the value of file input.
Because file object created once you has a file selected, and
File object that contain useful information about the file.
name
The file's name as a read-only string. This is just the file name, and does not include any path information.
here the file name is the value you want to change.
doc

Show file path in firefox/chrome [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Full path from file input using jQuery
I have the following html element
<input type="file" id="upload">
If I use
$("#upload").val();
I only the file name, not the complete absolute path of the file. Can someone tell me how do get the complete path?
You cannot do so - the browser will not allow this because of security concerns. Although there are workarounds, the fact is that you shouldn't count on this working. The following Stack Overflow questions are relevant here:
full path from file input using jquery
How to get the file path from HTML input form in Firefox 3
In addition to these, the new HTML5 specification states that browsers will need to feed a Windows compatible fakepath into the input type="file" field, ostensibly for backward compatibility reasons.
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-March/018981.html
The Mystery of c:\fakepath Unveiled
So trying to obtain the path is worse then useless in newer browsers - you'll actually get a fake one instead.

read local text file in javascript [duplicate]

This question already has answers here:
How do I read in a local text file with javascript?
(2 answers)
Closed 9 years ago.
I have a local test.txt file that I need to read into variable in JavaScript and send that variable to google.visualization.arrayToDataTable() to create a chart. Text in test.txt file is in right format (I tried to copy it directly into function and it works). But I don't know how to read that file into variable.
Reading local fine js is not permitted how ever you can use jQuery script function to load the data

Categories

Resources