问题
Is it possible to create a SharePoint (wss3 or MOSS 2007) webpart, to allow files to be dragged and dropped onto it, which would then upload the files into a predefined document library ?
I imagine that this would require some form of client side scripting (Ajax ?), but my knowledge in ajax is a bit sketchy.
From my exploration so far, I'm thinking:
- User drags file onto 'drop zone' Webpart.
- This action triggers some code
- This code Loads the file into a SharePoint library (like this : Uploading a File to SharePoint)
Any pointers would be gratefully recieved
Many thanks.
Nick
回答1:
Well,
What I'd do is, like you said, a web part with javascript that allow the user to drag and drop some files into a zone inside the webpart. Once the user has finished I'll upload those files after click on a Button of the webpart. I think is better to work with SharePoint in an unique transaction and not upload and delete files using AJAX. So, the drag and drop functionality can be done using some kind of javascript like Scriptaculous and the other one like a classic postback.
回答2:
You might also want to look at another way to perform this. If you do it in a webpart, you will need to add that webpart in every sites where you want this fonctionnality to work. You might want to try Sharegate (www.share-gate.com). It's a end user tool that allows you to drag and drop file from your computer (or any SharePoint list / library) to any SharePoint library. By dropping the document inside the library, you will be ask to select a property template where you can define all the properties attach to your document. Not only you will drag and drop documents, but you will structure the information at the same time. Hope this was helpful!
回答3:
Perhaps my reply is little bit irrelevant to your post! I think upload files to SharePoint is not a painstaking job, the build-in feature is enough for us to upload files. The trouble, I think, lies in the check in process, may be that is what you should do!
回答4:
Altought maybe not that important now, but there is a SharePoint addon on CodePlex now that allows files to be uploaded by Drag & Drop into SharePoint document libraries.
Available here: http://dndupload.codeplex.com/
Works in Firefox & Chrome, uses FileApi from HTML5, supports both SharePoint 2007 & 2010.
来源:https://stackoverflow.com/questions/696923/drag-and-drop-files-into-a-sharepoint-webpart-to-upload-into-doclibrary