locked
SharePoint 2010 upload files RRS feed

  • Question

  • Hello guys,

    I've got a question. I would like to know how many files can I upload in SharePoint.  I tried to upload 15 files, but SharePoint says no.

    Is it also possible to order the SharePoint uploaded by a specific value, e.g. size or date?

    Best regards

    Matthias

    Monday, January 20, 2014 12:57 PM

All replies

  • Hi

    please provide the error message received when you tried .

    As i know, the limitations is based on file size ( default value 50M ) and file type

    Also you should not reach the sharepoint's DB size

    You can upload files based on your criteria , using a powershell script. Otherwise, the upload is based on file's name criteria


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.


    • Edited by romeo donca Monday, January 20, 2014 1:31 PM
    Monday, January 20, 2014 1:30 PM
  • Thanks in advance! How can I upload the attachments via script. If I will upload this via script it will take teh script settings and not his own, right? So I upload a script and then will stay, e.g. ordered by size or by name, right?

    Best regards

    Matthias

    Monday, January 20, 2014 2:11 PM
  • hi

    examples how to use a script

    http://get-spscripts.com/2010/10/bulk-upload-files-with-metadata-into.html

    http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/23/use-powershell-cmdlets-to-manage-sharepoint-document-libraries.aspx

    How these docs  are ordered in your library depend how is configured the view, for specific list/library


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Monday, January 20, 2014 2:18 PM
  • If you want to upload files using code then you can check below code.

    Try to upload your solution using these below console application code and implement try catch blocks at required places and see what challenges you are facing while uplaoding the files.

    String fileToUpload = @"C:\YourFile.txt";
    String sharePointSite = "http://yoursite.com/sites/Research/";
    String documentLibraryName = "Shared Documents";

    using
    (SPSite oSite = new SPSite(sharePointSite))
    {
        using
    (SPWeb oWeb = oSite.OpenWeb())
       
    {
           
    if (!System.IO.File.Exists(fileToUpload))
               
    throw new FileNotFoundException("File not found.", fileToUpload);                   

           
    SPFolder myLibrary = oWeb.Folders[documentLibraryName];

           
    // Prepare to upload
           
    Boolean replaceExistingFiles = true;
           
    String fileName = System.IO.Path.GetFileName(fileToUpload);
           
    FileStream fileStream = File.OpenRead(fileToUpload);

           
    // Upload document
           
    SPFile spfile = myLibrary.Files.Add(fileName, fileStream, replaceExistingFiles);

           
    // Commit
            myLibrary
    .Update();
       
    }
    }


    Monday, January 20, 2014 2:18 PM
  • Hello,

    thanks in advance, but I use a normal list. I don't use a document library. Is it also possible to bin documents to the items and upload it in a specific order?

    Best regards

    Matthias

    Monday, January 20, 2014 2:55 PM
  •            

    Modified code to add files to sharepoint list. Give a try

    StringfileToUpload = @"C:\Users\abc\Desktop\FillValues.txt";

    StringsharePointSite = http://vvvvv:21629/sites/Test/;

    StringListName = "SampleList";

              

    using(SPSiteoSite = newSPSite(sharePointSite))

                {

                   

    using(SPWeboWeb = oSite.OpenWeb())

                    {

                       

    if(!System.IO.File.Exists(fileToUpload))

                           

    thrownewFileNotFoundException("File not found.", fileToUpload);

                       

    SPListdemolist = oWeb.Lists[ListName];

                        demolist.EnableAttachments =

    true;

                       

    SPListItemfolder = demolist.Folders.Add(demolist.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, "Folder Name");

                        folder.Update();

                       

    FileInfoattachment = newFileInfo(fileToUpload);

                       

    using(FileStreamfs = File.OpenRead(fileToUpload))

                        {

                           

                           

    // Create a byte array of file stream length


                           

    byte[] ImageData = newbyte[fs.Length];

                           

    //Read block of bytes from stream into the byte array


                            fs.Read(ImageData, 0, System.

    Convert.ToInt32(fs.Length));

                           

    //Close the File Stream


                            fs.Close();

                            folder.Attachments.Add(attachment.Name, ImageData);

                            folder.Update();

                        }

     

                    }

                }

    Monday, January 20, 2014 4:07 PM
  • In SharePoint central administration plz check the upload file settings
    Tuesday, January 21, 2014 7:28 AM