Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Passing a path string to PHP as3

Enthusiast ,
Jun 11, 2021 Jun 11, 2021

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
739
Translate
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
Community Expert ,
Jun 12, 2021 Jun 12, 2021

in as3:

 

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

 

in php

 

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

Translate
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

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?

Translate
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
Community Expert ,
Jun 12, 2021 Jun 12, 2021

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.

Translate
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

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?

Translate
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
Community Expert ,
Jun 12, 2021 Jun 12, 2021

how do you create the path?

Translate
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

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

trace(_path);

output:

D:GraphicsDigitalMarketing-02.jpg

Translate
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
Community Expert ,
Jun 12, 2021 Jun 12, 2021

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

 

 

Translate
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

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

Translate
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

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

Translate
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
Community Expert ,
Jun 14, 2021 Jun 14, 2021

did you embed punctuation?

Translate
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

Yes I did but even in trace output it doesn't show the backslash.. I am storing the path in a string. 

Translate
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
Community Expert ,
Jun 20, 2021 Jun 20, 2021

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.

Translate
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

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.

 

Translate
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
Community Expert ,
Jun 21, 2021 Jun 21, 2021
LATEST

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

 

 

Translate
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