Passing a path string to PHP as3
Copy link to clipboard
Copied
Hello
I am trying to send a path string to a php file but it needs to be encoded before.. so anyhow? thanks.
The path in as3: "D:\Graphics\Digital\Marketing-02.jpg"
In php it comes without "\": "D:GraphicsDigitalMarketing-02.jpg"
Copy link to clipboard
Copied
in as3:
sendpathstring.split("\").join("@");
in php
receivepathstring = implode("\",explode("@",sendpathstring));
Copy link to clipboard
Copied
Thanks for your responding
Actually the proplem is in the string in actionscript, when I trace the string "D:\Graphics\Digital\Marketing-02.jpg" the output shows this resault: D:GraphicsDigitalMarketing-02.jpg
Any idea?
Copy link to clipboard
Copied
yes, replace the back slash (an as3 escape character) with something else as suggested. exactly how you do that (and where you do that) deepends on how/where the string is created.
Copy link to clipboard
Copied
The string created in the same actionscript file, the big problem is that I can't replace it because as3 escape the character in .split() command!
Then how to store a path?
Copy link to clipboard
Copied
how do you create the path?
Copy link to clipboard
Copied
var _path:String = "D:\Graphics\Digital\Marketing-02.jpg";
trace(_path);
output:
D:GraphicsDigitalMarketing-02.jpg
Copy link to clipboard
Copied
in as3 use:
var _path:String = "D:\\Graphics\\Digital\\Marketing-02.jpg";
and in php you may need to use:
$_php_path = implode("\\",explode("\",$as3_path));
Copy link to clipboard
Copied
Thanks kglad I've used str_replace() command in PHP it works for now but still looking for some decoder for all the string because I am facing another problem with "&" charactor in the file name! I think the only way is to make a function to replace all the marks..
Copy link to clipboard
Copied
It won't work this way "var _path:String = "D:\\Graphics\\Digital\\Marketing-02.jpg";"
The path string should be taken from a text field..
Copy link to clipboard
Copied
did you embed punctuation?
Copy link to clipboard
Copied
Yes I did but even in trace output it doesn't show the backslash.. I am storing the path in a string.
Copy link to clipboard
Copied
when testing if you type a\b in your input textfield (eg, tf) and then trace tf.text, what do you see?
keep tracing as you do other things that you're not explaining here until you pinpoint the problem. then explain.
Copy link to clipboard
Copied
I explained many times.. I have no text field, I only have a string and I want to store a path in this string:
var _path:String = ("D:\Graphics\Digital\Marketing.jpg");
trace(_path); // Output: D:GraphicsDigitalMarketing.jpg
You can try te code.
Copy link to clipboard
Copied
you said this in your june 13 message, "The path string should be taken from a text field.."

