<input type=file>, jwplayer, javascript question -


i display file open box user can select file on computer:

<input type="file" id="upload_input"/> 

but when file user chose in javascript (see code below), believe 'safe' since javascript executes on client side -- file, not full path -- despite fact full path , filename appear in field next 'browse' button input type=file gives you.

in other words user selects file located on machine example @ c:/afolder/thefile.rtf. after choosing file full path appears in field next 'browse' button: c:/afolder/thefile.rtf

yet when programmatically retrieve value of field, entire path stripped off , have filename:

filename = document.getelementbyid('upload_input').value; alert("the selected file name " + filename); 

why input type=file control bother show user full path if can't programmatically? it's happening on client side after all, it's not full path on server.

one other question: use filename above , construct qualified path file, only sake of getting jwplayer code working. full path create development here temporary.

in otherwords, when filename above, this:

vidfname = ("c:/xampp/htdocs/thewebsite/afolder/" + filename); alert("the full path is: " + vidfname); 

and try play video in jwplayer:

playlist = { file: vidfname };  thejwplayer().load(playlist); thejwplayer().play(true); 

but jwplayer gives me "permission denied or file not found."

here had change work:

vidfname = ("http://localhost/thewebsite/afolder/" + filename); alert("the full path is: " + vidfname); playlist = { file: vidfname }; thejwplayer().load(playlist); thejwplayer().play(true); 

by changing path localhost above code works -- video loads , succesffully plays.

note: don't think 'folder permissions' issue because can play exact same file in same location different .flv player (standalone) app on computer. it's not folder permissions in c:/xampp that's making jwplayer 'permission denied or file not found.'

why won't jwplayer (or javascript..?) not letting me use fully-qualified pathname file when call jwplayer().load() ?

after all, i'm using 'thejwplayer' in javascript,' running on client computer, , file on client computer too, it's not security issue.

or there i'm missing here? note: apologize if question ignorant @ current level of web programming, may have passed long ago, puzzling, jwplayer().load() not working qualified path name.

browsers not reveal actual file paths javascript code. it's security thing. won't able @ local files without using (new, available in new browsers) html5 file handling apis, , won't give complete file pathnames.

similarly, when file input submitted form, server won't full path either.

i think it's not media player tool you're working designed work local files (that is, files on local file system browser running).


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -