krizalys / onedrive-php-sdk

OneDrive SDK for PHP
BSD 3-Clause "New" or "Revised" License
144 stars 66 forks source link

Issue on Sharing URL (reference to issue i previously posted; i cant reopen it) #70

Closed karinnahmay closed 4 years ago

karinnahmay commented 4 years ago

Hi @krizalys,

This is coming from issue #69 Unfortunately Shared link is not generated, here is my code:

  $stream = fopen($path_file, 'rb');
  $upload = $dataItem->startUpload(basename($path_file), $stream);
  $driveItem = $upload->complete();
  $permission = $dataItem->createLink("view");

can you please help or provide instructions on why this happened? Thanks sir!

karinnahmay commented 4 years ago

Also one more thing sir, in createLink("view"), this will return the specific file only right? cos based on what i read this will return the whole folder containing the file uploaded. How can i only get the specific file url without viewing the others on that folder?

this is for the client view (user) to avoid seeing the other files uploaded by other users. And a link that is viewable if i put it inside the

I tried this: $dataItem->createLink("view", ['scope' => 'anonymous']); but creating a link which every user can see.

i wanted to restrict that folder/file to specific user only

Please please help. Thanks!

krizalys commented 4 years ago

@karinnahmay There are 2 questions here. I will answer only the 1st one here and request you to open a separate issue for your 2nd question. Thanks.

In your code sample, I noticed that you are not using the same variable name: $driveItem on one line and $dataItem on the other. Can you fix that and let me know if that solves it? Please reopen if it does not.