Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload image without sending to user #872

Open
recoverjp opened this issue Aug 9, 2014 · 24 comments
Open

Upload image without sending to user #872

recoverjp opened this issue Aug 9, 2014 · 24 comments

Comments

@recoverjp
Copy link

Can I upload a picture and catch the filehash and size? Without sending for any user?

@Amirjan
Copy link

Amirjan commented Aug 9, 2014

This is a hash file function:
$filehash = base64_encode(hash_file("sha256", $filepath, true));
but only usable when has been saved in whatsapp server.
It's possible with upload.

@recoverjp
Copy link
Author

And how can I make upload without use sendMessageImage function?

@recoverjp
Copy link
Author

I need do upload an image and catch filepath, filehash and filesize.

@mgp25
Copy link
Contributor

mgp25 commented Aug 9, 2014

Why do you want to do that? You can upload the file without sending the media file. Check the API code. Follow what sendMessageImage does for example

@recoverjp
Copy link
Author

I want to do this for when the user requests an image, I take forward and not upload.

@recoverjp
Copy link
Author

When I send an image using sendMessageImage(), it does not return me a valid url for the picture which I sent. But when I get a picture using the getMessages(), it returns me a valid url for the image. Can anyone help me?

@Amirjan
Copy link

Amirjan commented Aug 10, 2014

File name does not matter, you need only file hash and file size to forward media message.

@recoverjp
Copy link
Author

Amirjan, but... $this->sendRequestFileUpload($fhash, 'image', $fsize, $filepath, $to);

And public function sendMessageImage($to, $filepath, $storeURLmedia = false, $fsize = 0, $fhash = "")

I need to send the $filepath, no?

@recoverjp
Copy link
Author

How long a file is stored in the whatsapp server? For example, I uploaded some files that are no longer working: https://mms890.whatsapp.net/d/tow7dxB9q4CCbkdCL7lVlQHa9igABP_tXdjUMQ/AvZFt377o39nPUgrDKhuu7o3vMcUhWD3kzRu4zJfTMQ_.jpg

@mgp25
Copy link
Contributor

mgp25 commented Aug 10, 2014

If you have the file hash and size you dont need to set the path to the file.

WhatsApp media cant be open in browser (computer) try sending that to you

@recoverjp
Copy link
Author

@Amirjan
Copy link

Amirjan commented Aug 10, 2014

$w->sendMessageImage($to, 'any.jpg', false,147792, '6h3qcEQw+O+F7gUa5gSqv+yZ1aZ6x32172HvTPBXkSo=');

@recoverjp
Copy link
Author

Amirjan, yeah. It worked. Thank so much. My problem now became the files as giving "Media object not found". It is some protection from Whatsapp?

@mgp25
Copy link
Contributor

mgp25 commented Aug 10, 2014

Didnt know that media url could be opened. The device app instead of taking the size and hash takes a hash value and the url, stores that data in a .db.

Nope.

I'll try to upload some examples using this lately

@Amirjan
Copy link

Amirjan commented Aug 10, 2014

#864

@recoverjp
Copy link
Author

mgp25, when I receive a file using the api, I can grab the full url and access it via the web. But after a few moments the image is no longer accessible.

@recoverjp
Copy link
Author

I developed a website to provide several files that send through whatsapp. For example, audios, videos, pictures. And I need to send these files to the whatsapp server, so that when the user requests this file, it is forwarded. (because it is faster) The problem is that the files are no longer accessible after some time. This is a protection against access via web?

@recoverjp
Copy link
Author

Someone let me know how long a file is stored in the whatsapp servers? For example, I have the hash and size of a file. For how long can I forward this file?

@mgp25
Copy link
Contributor

mgp25 commented Aug 10, 2014

That is a server side function. I think they dont delete anything, and if they find any file duplicate doesnt upload it. I was able to send a file i uploaded +3 month ago :p

@recoverjp
Copy link
Author

mgp25, but why i can't access this file?
https://mmi233.whatsapp.net/d/gRHgZg9NwOzHTw-ZTP4OEW2NNYkABQAiGr2ePg/AgR0SehAFz1hRAsVnqcSH5H4qgbKOcN1z1Ce__JeII7L.jpg
I sent this file 3 days ago
Is it because I accessed it via web?

@mgp25
Copy link
Contributor

mgp25 commented Aug 10, 2014

Maybe. You can try sending the media file using the url, and if you receive the media file, thats it :)

@shirioko
Copy link
Contributor

Received media file URLs only have a limited lifetime so people won't use WhatsApp as an image upload service.

@recoverjp
Copy link
Author

hmmmmm ... makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants