i'm using to tempnam(sys_get_temp_dir(), $fileName);
to temporary save an image in the /private/var/tmp.
The images are being save with a weird text after them For example:
10153114610662388_1434185314.jpggd5Wc6
After i'm saving them, I'm uploading them to facebook and it gives me the following error {"error":"(#324) Requires upload file"}
and I think it because of that.
From the PHP documentation (http://php.net/manual/en/function.tempnam.php) for
tempnam
:So the second parameter is a prefix for the filename, not the filename that it will use.
tempnam
makes sure that the filename is unique (so you don't overwrite another temp file) - and that's what the "weird text" at the end is for.If you want to save the file with the filename you already have just use it directly - but understand that if a file with that name already exists you'll overwrite it.