I have two input fields, one with a / li> the file was uploaded correctly The problem is that I get the How do I solve it? I need only to HTML Part: PHP part (requires simplified, security): JS Part: Just remove the last string before the last slash. What is the same in your case back Has come and X is what you want Solution 2: Solution 3: type = file and other type The form is = to dir / file_name in the Type = text field file name incorrect, depending on the browser I'm using.
somepath / file_name.ext some path / c: \ user \ user \ desktop \ file_name.ext sompt / C: \ fakepath \ file_name.ext file_name.ext , such as Firefox does not have to say that the file name should be detected and the appropriate text field to be replaced Because the file is selected and before the form is submitted.
& lt; Form enctype = "multipart / form-data" action = "" method = "post" & gt; & Lt; Input name = "data_up" id = "data_up" type = "file" /> gt; & Lt; Br> & Lt; Input name = "data" id = "data" type = "text" value = "
if (isset ($ _ POST ['submit']) {if ($ _FILES ["Data_up"] ["Error"] == 0] {move_uploaded_file ($ _ files ["data_up"] ["tmp_name"], "some path /" [files] ["data_up"] ["name"] ); }}
& lt; Script type = "text / javascript" & gt; $ (Function () {$ ('# data_up'). Change (function () {var fileName = $ (this) .val (); $ ('# data'). Val ('somepath /' + fileName); });}); & Lt; / Script & gt;
var v = 'some \\ thing \\ text.txt'; Var x = ''; For (i = v.length-1; i> = 0; i--) if (v [i]! = '/' & Amp; amp; amp; amp; ve [i]! = '\\') x = V [i] + x; And break; Console.log (x);
var v = 'some / cheese / text.txt' ; Var y = v.split (/ [\\\ /] /); Var x = y [y.length-1]; Console.log (x);
var v = 'vava \\ text.txt'; Console.log (v.replace (/.*[\\\/]/g, ''));
No comments:
Post a Comment