Passing a path string to PHP as3

Enthusiast ,
Jun 11, 2021 Jun 11, 2021

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" 

TOPICS
ActionScript , Code

Views

228

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 12, 2021 Jun 12, 2021

Copy link to clipboard

Copied

in as3:

 

sendpathstring.split("\").join("@");

 

in php

 

receivepathstring = implode("\",explode("@",sendpathstring));

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 12, 2021 Jun 12, 2021

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?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 12, 2021 Jun 12, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 12, 2021 Jun 12, 2021

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?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 12, 2021 Jun 12, 2021

Copy link to clipboard

Copied

how do you create the path?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 12, 2021 Jun 12, 2021

Copy link to clipboard

Copied

var _path:String = "D:\Graphics\Digital\Marketing-02.jpg";

trace(_path);

output:

D:GraphicsDigitalMarketing-02.jpg

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 12, 2021 Jun 12, 2021

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));

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 13, 2021 Jun 13, 2021

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..

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 13, 2021 Jun 13, 2021

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..

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

did you embed punctuation?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 19, 2021 Jun 19, 2021

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. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 20, 2021 Jun 20, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 20, 2021 Jun 20, 2021

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.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

LATEST

you said this in your june 13 message, "The path string should be taken from a text field.."

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines