• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

I need a repository where people can dropfiles....

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    I need a repository where people can dropfiles....

    I need something where I can drop files into a repository from a webpage, I have an Azure account that I am not using so if its Windows based that's better.

    Whats the easiest way to do this? Anyone know an EFT type app?
    Originally posted by Stevie Wonder Boy
    I can't see any way to do it can you please advise?

    I want my account deleted and all of my information removed, I want to invoke my right to be forgotten.

    #2
    I use Owncloud on a small server at home. Not a Raspberry Pi but similar.

    Comment


      #3
      I would probably knock something up but not sure of your requirements. Once the files are uploaded do you want the user to see them, delete them etc.

      Anyway, I've been using Dropzone.js for drag and drop file uploads.

      If you are using ASP.NET MVC then just make reference to the relevant dropzone css/js.


      Add drop zone to the page for example

      Code:
                      <div id="dropzone">
                          <form action="@Url.Action("Upload", "ControllerNameHere")" class="dropzone dz-clickable" id="demoUpload" style="border: 2px dashed #816bb1">
                         
                              @Html.EditorFor(model => model.TemporaryId)
                              <div class="dz-message">
                                  Drop files here or click to upload.<br />
      
                              </div>
      
                          </form>
                      </div>
      Then in the upload controller add a method to handle the files that are being posted for example the method below creates a folder using a guid. That's because it's a temp holding place for the files, but you could just use a user id or put everything in the temp/upload folder.

      Code:
              [HttpPost]
              public ActionResult Upload(string temporaryId)
              {
                  try
                  {
                      //use the temp id to create a folder structure for the uploaded images.
                      foreach (string fileName in Request.Files)
                      {
                          var file = Request.Files[fileName];
                          //Save file content goes here
                          //name = file.FileName;
                          if (file != null && file.ContentLength > 0)
                          {
      
                              var originalDirectory = new DirectoryInfo(string.Format("{0}\\temp\\upload", Server.MapPath("~")));
                              var pathString = Path.Combine(originalDirectory.ToString(), temporaryId);
      
                              if (!Directory.Exists(pathString))
                                  Directory.CreateDirectory(pathString);
      
                              var path = string.Format("{0}\\{1}", pathString, file.FileName);
                              file.SaveAs(path);
                          }
      
                      }
                  }
                  catch (Exception exception)
                  {
                      log.Error("Error uploading files " + exception);
                      return Json(new { success = "False" });
                  }
      
                  return Json(new { success = "True" });
              }
      It's worth saying this example automatically uploads the files when they are dropped on the control but you can configure to do on a button etc.

      Comment

      Working...
      X