facebook graph api - php tempnam(sys_get_temp_dir(), $fileName); saves in wierd name -


i'm using tempnam(sys_get_temp_dir(), $filename); temporary save image in /private/var/tmp.

the images being save weird text after them example:

10153114610662388_1434185314.jpggd5wc6

after i'm saving them, i'm uploading them facebook , gives me following error {"error":"(#324) requires upload file"} , think because of that.

from php documentation (http://php.net/manual/en/function.tempnam.php) tempnam:

string tempnam ( string $dir , string $prefix ) 

dir directory temporary filename created.

prefix prefix of generated temporary filename.

so second parameter prefix filename, not filename use. tempnam makes sure filename unique (so don't overwrite temp file) - , that's "weird text" @ end for.

if want save file filename have use directly - understand if file name exists you'll overwrite it.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -