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

file sharing/upload service integration #58

Open
qwertygc opened this issue Nov 11, 2014 · 10 comments
Open

file sharing/upload service integration #58

qwertygc opened this issue Nov 11, 2014 · 10 comments
Labels
feature plugin bells and whistles tools developer tools

Comments

@qwertygc
Copy link

Hi ! It's possible to add a field for upload a file (e.g a PDF) ?
I have a little snippet :

if(isset($_POST['upload'])) {
                $files = array();
                $fdata = $_FILES['fichier'];
                $count = count($fdata['name']);
                if(is_array($fdata['name'])){
                    for($i=0;$i<$count;++$i){
                        $files[]=array(
                            'name'     => $fdata['name'][$i],
                            'tmp_name' => $fdata['tmp_name'][$i],
                            'type' => $fdata['type'][$i],
                        );
                    }
                }
                else {$files[]=$fdata;}
                foreach ($files as $file) {
                    if(!is_uploaded_file($file['tmp_name'])) {exit();}
                    $nb_img = file_get_contents('/upload.txt');
                    $file['name']=$nb_img.$file['name'];
                    $nb_img++;
                    file_put_contents('upload.txt', $nb_img);
                    if(!move_uploaded_file($file['tmp_name'], 'data/upload/'. $file['name']) ) {exit();}
                }
            }``
``<input type="file" name="fichier[]" multiple/>

@nodiscc
Copy link
Member

nodiscc commented Nov 17, 2014

Hi @qwertygc thanks for the suggestion. I'm not sure at all Shaarli should directly integrate this:

  • How do you delete a file once it's uploaded?
  • When adding features such as file upload, you have to do tons of work to make sure it doesn't introduce vulnerabilities. (could an attacker circumvent it to upload an arbitrary file? can you mistakenly execute code from a malicious file that's been uploaded? Lots more. Lots of extra code and precautions that you can very easily get wrong.)
  • Shaarli should stay basically a link sharing platform, with optional integration for other services.

but I see where you're coming from, as I regularly want to share personal files on Shaarli. I have to upload them to another service first (eg. my Owncloud instance), get the link, and manually share them with Shaarli. Boring. A solution to make this easier would be a cool addition.

What would be reasonable:

  • This should be a plugin, not in core code (I've proposed a plugin system at Plugin system #52, already 3 plugins proposed - archiveorg, readityourself, playvideos - check it out)
  • The file upload should not rely on Shaarli, it should integrate a third party file hosting service (preferably self-hostable like owncloud, seafile...)
  • An example that comes to mind: add an "Upload and shaare file" button, have this button pop up a "file upload" dialog from your hosting service, let you upload the file, get the shared file URL, pass it to Shaarli's ?do=addlink to share it.

If someone can come up with a solution to this it would be nice. But someone has to review the plugin system first. Other maintainers, ping.

@nodiscc nodiscc changed the title upload and linked a file upload and link a file Nov 20, 2014
@nodiscc nodiscc removed the discussion label Dec 1, 2014
@nodiscc nodiscc changed the title upload and link a file file sharing/upload service integration Dec 1, 2014
@nodiscc nodiscc mentioned this issue Feb 18, 2015
@nodiscc
Copy link
Member

nodiscc commented Feb 23, 2015

Closing this as no one is willing to work on it at the moment, I've added it to https://github.com/shaarli/Shaarli/wiki/Ideas-for-plugins. Feel free to reopen if there are updates, this is something I'd really like to have on the long run.

@nodiscc nodiscc closed this as completed Feb 23, 2015
@nodiscc nodiscc added feature and removed wontfix labels May 11, 2015
@nodiscc nodiscc added this to the future milestone May 11, 2015
@nodiscc
Copy link
Member

nodiscc commented May 11, 2015

Reopening to make issue visible in issues list (cleaning up the Ideas for plugins wiki page)

@nodiscc nodiscc reopened this May 11, 2015
@virtualtam virtualtam added the tools developer tools label Jul 8, 2015
@ArthurHoaro
Copy link
Member

The file upload should not rely on Shaarli, it should integrate a third party file hosting service (preferably self-hostable like owncloud, seafile...)

I don't know... Making a secure file uploader isn't that hard. And it could be a very useful feature (I usually use PluXML to host the file, then share the link).

It could be done through the plugin system I pushed (need to had a hook on link deletion).

An OwnCloud plugin isn't a bad idea either, but OwnCloud is definitely to huge to shaare an image or a doc from time to time. It could be done through this API though. Here is a blog post with a guy playing with it.

@nicolasdanelon
Copy link

Shaarli is for shaaring your link. The personal, minimalist, super-fast, no-database delicious clone. What the hell has to do a file uploader?

@qwertygc
Copy link
Author

We can would share files (for example a pdf version of article of an paying newspaper).

@Marsup
Copy link

Marsup commented Jul 24, 2015

Then share a public link to it (dropbox or whatever). This should not be shaarli's concern.

@nicolasdanelon
Copy link

if this feature is added as a plugin I'm ok :) again, Shaarli is for shaaring your link.

@nodiscc
Copy link
Member

nodiscc commented Jul 15, 2019

https://github.com/hauxir/imgpush could be used if a plugin wants to delegate image uploads to another tool.

Minimalist Self-hosted Image Service for user submitted images in your app

@ArthurHoaro
Copy link
Member

Interesting, and simple. But this plugin should allow any type of document, not just images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature plugin bells and whistles tools developer tools
Projects
None yet
Development

No branches or pull requests

6 participants