2

here i have variable fileVal takes path of file like uploads/import/abc.pdf

var fileVal = $('#fileimport').val();

here fileVal takes path of file like uploads/import/abc.pdf

i have to send this file path as url variable to a php file and then display result on messagediv. like

  $('#messagediv').load('../xyz.php?file='+fileVal);

here without url variable, its working perfect getting values to the messagediv.

But where as using url variable its not.

How i can solve this?

2
  • Well, don't send it as URL. Break it in several get variables. Like ...xyz.php?path=uploads-import&filename=abc.pdf then construct the url in xyz.php by replacing the dashes of the path with forward slashes and adding the filename at the end Commented Nov 24, 2012 at 14:01
  • There's nothing wrong with how it's constructed. Commented Nov 24, 2012 at 14:14

2 Answers 2

1

try with encodeURIComponent()

var fileVal =  encodeURIComponent($('#fileimport').val());
Sign up to request clarification or add additional context in comments.

Comments

0

That should work fine except you have a syntax error

// $var fileVal = $('#fileimport').val();
var fileVal = $('#fileimport').val();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.