Prevent overwrite of upload file

I'm using jspsmart to upload file to the server.
How can I prevent overwrite of file ?
for example,
User A have a file call "abc.txt" in the server. Now, another user B upload a file call "abc.txt".
The problem is User A and User B upload the file with the same filename in the same directory.
Any method can give User B a warning signal to prevent overwrite of the file.
Thank you !

To prevent an overwrite of a file, first check to see if file exists BEFORE uploading the file.
For example.
String filename = "abc.txt";
File f = new File(filename);
if(f.exists()) // file already exists ->give error
else // file not exists->upload file

Similar Messages

  • Business Catalyst Help | Upload files to the site

    This question was posted in response to the following article: http://helpx.adobe.com/business-catalyst/sbo/upload-files-using-file-manager.html

    Hi Kevin,
    I assume that you have created your site through Muse. In this case, by default, File Manager is disabled to prevent the risk of accidental content overwrites since there is no roundtrip between Muse and the online editor.
    If you wish to enable the File Manager, edit your account settings (by clicking on your name on the top right corner and selecting My Details) and check the Enable online content editing box.
    This will enable several options into your menu, including the file manager.
    Cristinel

  • Is there a way to silently upload files?

    Ok, so I've taken the plunge. I've started working on an AIR
    app using Flash CS3. I'm putting together a little app that will
    keep my online store updated with all the product updates from our
    wholesaler. This includes parsing a csv file, downloading product
    images from the wholesaler, updating the database, and then
    uploading the images to our server.
    The problem is that AIR does not seem to have the
    functionality to silently upload files! Sure, I can use the
    file.reference object to fire off the browse method, which then
    opens the OS file browser window BUT I would really like the whole
    thing to be hands off. In the past, I've written these types of
    apps using Visual Studio but I haven't touched VS in two years.
    Has anyone run across a way to silently upload or ftp files
    in AIR?

    Hey Oliver,
    Thanks for your answer--the fact that it CAN be done has
    gotten me a lot further on finding a solution. Here's what I have
    so far. As it runs, I can see the progress and completion of the
    upload but I'm still not getting it saved. I'm uploading it to a
    ColdFusion processing page.
    AS3 Code:
    import flash.filesystem.*;
    import flash.net.URLRequest;
    //Silent File Upload (no browse window)
    function imageUpload(imageName,uploadPage):void
    trace('Starting Upload of ' + imageName + '\n');
    var myFile:File =
    File.applicationDirectory.resolvePath(imageName);
    var request:URLRequest = new URLRequest(uploadPage);
    request.method = URLRequestMethod.POST;
    myFile.addEventListener(ProgressEvent.PROGRESS,progressHandler);
    myFile.addEventListener(Event.COMPLETE,completeHandler);
    myFile.upload(request,"theFile");
    function progressHandler(event:ProgressEvent):void {
    var file:FileReference = FileReference(event.target);
    var pLoaded =
    Math.ceil(event.bytesLoaded/event.bytesTotal*100);
    trace(pLoaded + '% uploaded');
    function completeHandler(event:Event):void
    trace ('Upload complete.');
    var uploadPage = "
    http://www.aaronbday.com/upload_file.cfm";
    imageUpload("angelic_cat.jpg",uploadPage);
    Here's the CFM page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Upload File</title>
    </head>
    <body>
    <cfif isDefined("form.theFile")>
    <!---we only want images--->
    <cffile
    action="upload"
    destination="#ExpandPath("test/")#"
    filefield="theFile"
    nameconflict="overwrite"
    accept="image/jpg,image/jpeg,image/gif,image/pjpeg"
    >
    <cfoutput><img src="test/#cffile.serverFile#"
    /></cfoutput>
    <cfelse>
    <form method="post" action="upload_file.cfm"
    enctype="multipart/form-data">
    <input type="file" name="theFile" />
    <input type="submit" name="Submit" />
    </form>
    </cfif>
    </body>
    </html>
    Any ideas? Thanks!

  • Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout).

    Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout). It is as if the server has decided that the client has timed out during the file upload. The default setting is 30 seconds for AcceptTimeout in the magnus.conf file. This should be ample to get the file across, even increasing this to 2 minutes just produces the same error after 2 minutes. Any help appreciated. Apologies if this is not the correct forum for this, I couldn't see one for iPlanet and Web, many thanks, Kieran.

    Hi,
    You didnt mention which version of IWS. follow these steps.
    (1)Goto Web Server Administration Server, select the server you want to manage.
    (2)Select Preference >> Perfomance Tuning.
    (3)set HTTP Persistent Connection Timeout to your choice (eg 180 sec for three minutes)
    (4) Apply changes and restart the server.
    *Setting the timeout to a lower value, however, may    prevent the transfer of large files as timeout does not refer to the time that the connection has been idle. For example, if you are using a 2400 baud modem, and the request timeout is set to 180 seconds, then the maximum file size that can be transferred before   the connection is closed is 432000 bits (2400 multiplied by 180)
    Regards
    T.Raghulan
    [email protected]

  • Powershell: How do I upload files with metadata from a manifest file?

    I am using the script from this blog to try to upload files into SharePoint, using a manifest file to specify the metadata associated with each file. Right now, the script works, but is not populating
    the metadata from the manifest (xml) file. When I write the $metadataManifest variable out to the console, I get the contents of my xml file, so the code is reading the file when it should. However when it gets to the line in bold ($metadataManifest.Columns.Column),
    it does not go into that block...it just skips on to checkin the file. Again the $metadataManifest variable shows all the content in my xml manifest file. Here is what the script looks like...
    #Get web and document library objects
    $web = Get-SPWeb "http://companySite"
    $Library = "My Library"
    $docLibrary = $web.Lists[$Library]
    $ManifestFilePath = "C:\PowerShellScripts\Manifest.xml"
    $LocalPath = "C:\Upload\Test Upload\My Upload Directory\"
    if ($ManifestFilePath)
    $metadataManifest = (Get-Content ($ManifestFilePath))
    write-host "Manifest file: " $metadataManifest
    else
    write-host "Manifest file not specified for categorising uploaded documents"
    #Check for the LibraryStartFolder parameter to specify a root folder
    if ($PSBoundParameters.ContainsKey('LibraryStartFolder')) {
    $folder = $web.GetFolder($docLibrary.Title + $LibraryStartFolder)
    else
    $folder = $docLibrary.RootFolder
    #Attach to local folder and enumerate through all files
    if($IncludeSubFolders) {
    $files = Get-ChildItem $LocalPath -Recurse
    else
    $files = Get-ChildItem $LocalPath
    $files | ForEach-Object {
    #Check if the object is a folder - if so, create it in doc library
    if ($_.PSIsContainer) {
    if (($IncludeSubFolders) -and (!$FlattenStructure)) {
    #Generate folder path for creation in SharePoint
    #by looking at the parent folder on the local path
    $spFolderPath = ($_.Parent.FullName.Replace($LocalPath,"")).Replace("\","/")
    #Get the folder into which the new folder will be created
    #by adding the folder path generated above, if one existed
    if ($spFolderPath -eq "") {
    $currentFolder = $web.GetFolder($folder.Url)
    else
    $currentFolder = $web.GetFolder($folder.Url + $spFolderPath)
    #Check to see if subfolder already exists
    #and create it if not
    $testFolder = $currentFolder.SubFolders[$_.Name]
    if ($testFolder -eq $null) {
    write-host "`nAdding folder" $_.Name "to" $docLibrary.Title "in" $web.Title "..." -foregroundcolor Green
    $newFolder = $currentFolder.SubFolders.Add($_.Name)
    else
    write-host "`nFolder" $_.Name "already exists in" $docLibrary.Title "and shall not be created" -foregroundcolor Red
    else
    #Generate file path for upload into SharePoint
    if ($FlattenStructure) {
    $spFilePath = ("/" + $_.Name)
    else
    $spFilePath = ($_.FullName.Replace($LocalPath,"")).Replace("\","/")
    $spFullPath = $folder.Url + "/" + $spFilePath
    #Check if the file exists and the overwrite option is selected before adding the file
    if ((!$web.GetFile($spFullPath).Exists) -or ($Overwrite)) {
    #Add file
    write-host "`nCopying" $_.Name "to" $spFullPath.Replace("/" + $_.Name,"") "in" $web.Title "..." -foregroundcolor Green
    $spFile = $folder.Files.Add($spFullPath, $_.OpenRead(), $true)
    #$spFile = $folder.Files.Add($folder.Url + "/" + $file.Name, [System.IO.Stream]$fileStream, $true)
    $spItem = $spFile.Item
    #Walk through manifest XML file and configure column values on the file
    $metadataManifest.Columns.Column | ForEach-Object {
    #Single value text columns
    try
    if (($_.Type -eq "Text") -or
    ($_.Type -eq "Choice") -or
    ($_.Type -eq "Boolean") -or
    ($_.Type -eq "Number") -or
    ($_.Type -eq "Currency")) {
    $columnName = $_.Name
    write-host "Setting value on column"$columnName "..." -foregroundcolor Blue
    $_.Values.Value | ForEach-Object {
    $spItem[$columnName] = $_
    write-host "Value set to"$_
    catch {}
    #Multiple line text column
    try
    catch {}
    #Multiple choice columns
    try
    catch {}
    #Hyperlink columns
    try
    catch {}
    #Single User column
    try
    catch {}
    #Multiple User column
    try
    catch {}
    #Single value Managed Metadata column
    try
    catch {}
    #Multi value Managed Metadata column
    try
    catch {}
    #Update document with new column values
    $spItem.SystemUpdate($false)
    #Check in file to document library (if required)
    #MinorCheckIn=0, MajorCheckIn=1, OverwriteCheckIn=2
    if ($CheckIn) {
    if ($spFile.CheckOutStatus -ne "None") {
    $spFile.CheckIn("File copied from " + $filePath, 1)
    write-host $spfile.Name"checked in"
    #Approve file (if required)
    if ($Approve) {
    if ($spItem.ListItems.List.EnableModeration -eq $true) {
    $spFile.Approve("File automatically approved after copying from " + $filePath)
    if ($spItem["Approval Status"] -eq 0) { write-host $spfile.Name"approved" }
    else
    write-host "`nFile"$_.Name "already exists in" $spFullPath.Replace("/" + $_.Name,"") "and shall not be uploaded" -foregroundcolor Red
    $web.Dispose()
    And here is what the manifest file looks like...
    <?xml version="1.0" encoding="utf-8"?>
    <Columns>
    <Column Name="Column1" Type="Text">
    <Values>
    <Value>First File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Column1" Type="Text">
    <Values>
    <Value>Second File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>9876</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data2</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More more Data</Value>
    </Values>
    </Column>
    </Columns>
    I can't figure out what am doing wrong...why my script is not iterating through the manifest file to upload the document along with the metadata. I would really appreciate any help. Thanks

    Hi Spawn,
    Name should not be a problem.. I will probably post you the entire code (I modified it to meet your goals for having multiple column xml nodes as well)
    For the code snippet below:
    a. In powershell all my changes will have ## prefixed comments
    b. in XML I have changed one column name to "Name" to replicate your case and also added a parent node for making the xml well formed.
    and the SharePoint output
    Please see the code below
    $web = Get-SPWeb "http://intranet/sites/test"
    $Library = "My Library"
    $docLibrary = $web.Lists[$Library]
    $ManifestFilePath = "D:\Manifest.xml"
    $LocalPath = "D:\UploadPath\"
    if ($ManifestFilePath)
    ##read the xml file as an xml object
    [xml]$metadataManifest = (Get-Content ($ManifestFilePath))
    write-host "Manifest file: " $metadataManifest
    else
    write-host "Manifest file not specified for categorising uploaded documents"
    #Check for the LibraryStartFolder parameter to specify a root folder
    if ($PSBoundParameters.ContainsKey('LibraryStartFolder')) {
    $folder = $web.GetFolder($docLibrary.Title + $LibraryStartFolder)
    else
    $folder = $docLibrary.RootFolder
    #Attach to local folder and enumerate through all files
    if($IncludeSubFolders) {
    $files = Get-ChildItem $LocalPath -Recurse
    else
    $files = Get-ChildItem $LocalPath
    $counter=0
    $files | ForEach-Object {
    #Check if the object is a folder - if so, create it in doc library
    if ($_.PSIsContainer) {
    if (($IncludeSubFolders) -and (!$FlattenStructure)) {
    #Generate folder path for creation in SharePoint
    #by looking at the parent folder on the local path
    $spFolderPath = ($_.Parent.FullName.Replace($LocalPath,"")).Replace("\","/")
    #Get the folder into which the new folder will be created
    #by adding the folder path generated above, if one existed
    if ($spFolderPath -eq "") {
    $currentFolder = $web.GetFolder($folder.Url)
    else
    $currentFolder = $web.GetFolder($folder.Url + $spFolderPath)
    #Check to see if subfolder already exists
    #and create it if not
    $testFolder = $currentFolder.SubFolders[$_.Name]
    if ($testFolder -eq $null) {
    write-host "`nAdding folder" $_.Name "to" $docLibrary.Title "in" $web.Title "..." -foregroundcolor Green
    $newFolder = $currentFolder.SubFolders.Add($_.Name)
    else
    write-host "`nFolder" $_.Name "already exists in" $docLibrary.Title "and shall not be created" -foregroundcolor Red
    else
    #Generate file path for upload into SharePoint
    if ($FlattenStructure) {
    $spFilePath = ("/" + $_.Name)
    else
    $spFilePath = ($_.FullName.Replace($LocalPath,"")).Replace("\","/")
    $spFullPath = $folder.Url + "/" + $spFilePath
    #Check if the file exists and the overwrite option is selected before adding the file
    if ((!$web.GetFile($spFullPath).Exists) -or ($Overwrite)) {
    #Add file
    write-host "`nCopying" $_.Name "to" $spFullPath.Replace("/" + $_.Name,"") "in" $web.Title "..." -foregroundcolor Green
    $spFile = $folder.Files.Add($spFullPath, $_.OpenRead(), $true)
    #$spFile = $folder.Files.Add($folder.Url + "/" + $file.Name, [System.IO.Stream]$fileStream, $true)
    $spItem = $spFile.Item
    ## ensure we pick the corresponding node in the columns xml (first file, first xml node, second file - second node likewise)
    #Walk through manifest XML file and configure column values on the file
    $metadataManifest.FileData.Columns[$counter].Column | ForEach-Object {
    #Single value text columns
    try
    if (($_.Type -eq "Text") -or
    ($_.Type -eq "Choice") -or
    ($_.Type -eq "Boolean") -or
    ($_.Type -eq "Number") -or
    ($_.Type -eq "Currency")) {
    $columnName = $_.Name
    write-host "Setting value on column"$columnName "..." -foregroundcolor Blue
    $_.Values.Value | ForEach-Object {
    $spItem[$columnName] = $_
    write-host "Value set to"$_
    catch {}
    #Multiple line text column
    try
    catch {}
    #Multiple choice columns
    try
    catch {}
    #Hyperlink columns
    try
    catch {}
    #Single User column
    try
    catch {}
    #Multiple User column
    try
    catch {}
    #Single value Managed Metadata column
    try
    catch {}
    #Multi value Managed Metadata column
    try
    catch {}
    #Update document with new column values
    $spItem.SystemUpdate($false)
    ##increment the counter to read the next xml node
    $counter++
    #Check in file to document library (if required)
    #MinorCheckIn=0, MajorCheckIn=1, OverwriteCheckIn=2
    if ($CheckIn) {
    if ($spFile.CheckOutStatus -ne "None") {
    $spFile.CheckIn("File copied from " + $filePath, 1)
    write-host $spfile.Name"checked in"
    #Approve file (if required)
    if ($Approve) {
    if ($spItem.ListItems.List.EnableModeration -eq $true) {
    $spFile.Approve("File automatically approved after copying from " + $filePath)
    if ($spItem["Approval Status"] -eq 0) { write-host $spfile.Name"approved" }
    else
    write-host "`nFile"$_.Name "already exists in" $spFullPath.Replace("/" + $_.Name,"") "and shall not be uploaded" -foregroundcolor Red
    $web.Dispose()
    and the xml file
    <?xml version="1.0" encoding="utf-8"?>
    <FileData>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>First File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>Second File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>Third File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>Fourth File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>Fifth File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    </FileData>
    Thanks and Regards,
    Partha
    AvePoint

  • Here's a fix for uploaded files that won't play.

    Is this you?  You've found a lot of files were uploaded, instead of matched.  Some of those files might even be on albums where other tracks matched. Sure you want them ALL to match, but meantime, it would be nice if uploaded files would actually play!  Sure, you can see their names, track durations, etc. but if you try to play them directly, nothing happens and if you try to play an album through, when it gets to an uploaded track, it stalls or skips past it.  You've checked the file type and it's an AAC so you figure it can't be a file encoding incompatibility problem and besides, whatever the file type, Apple is red-flagging anything incompatible, tells you it's ineligible, right?
    Guess Again - not all AAC files are produced with the same encoder and some of them, while they'll get past Apple's eligibile/ineligible screening process, probably shouldn't.
    I routinely record vinyl using Audacity and at various times I've used different encoders (not that I knew it until now).  As a result of checking which uploaded files play and which do not, I'm pretty confident of the following. While some AAC files created outside of iTunes might work, those encoded using Lavf52.36.0 will not.  Neither will files encoded using Lavf52.64.2.  There may be others.
    So what's the fix?  The same one recommended for getting files flagged by Apple as ineligible to pass muster.  You need to make an AAC copy in iTunes and swap that for the uploaded files that won't play.
    Here are the steps I use to get it done. You may be able to streamline the process though.
    (1) Turn off wi-fi to prevent iTunes Match from attempting to match any new files until you're good and ready.  If you don't to this, you may end up with files you've just created being flagged as duplicates.
    (2) Select all files in an album that has some bad uploaded files. Select Advanced > Create AAC Version.  (NOTE: I don't bother trying to separate uploaded from matched, just too much hassle.)
    (3) Select one of the files, so you can File > Reveal In Finder. Generally this will get you to the album folder that includes both sets of tracks.  The ones you just created will have a "1" in the file name.
    (4) Create a folder on the desktop and move all the newly created files to it.  Delete the "1" from the file names.  Name the folder based on album title.
    (5) In iTunes, delete the listings for the newly created files.
    (6) Turn on wi-fi and wait for iCloud to reconnect.  Watch the cloud icon - it'll tell you.
    (7) Delete the album from iTunes (You're now getting rid of the copy that was originally uploaded, so be sure you've really got the new AAC files handy to replace them with).  Note you will see an option to delete from iCloud too.  Check it.  You want these files GONE!
    (8) Select Store > Update iTunes Match. If you do a search for the album from an iCloud enabled iOS device (I use Apple TV) after the update is completed, you shouldn't be able to find the album.
    (9) Select File > Add To Library and go get the folder of tunes you created.
    (10) Run Update iTunes Match again.
    (11) Watch the iTunes progress bar. Once the matching process has checked to see if you've added anything to your library, you'll see fresh copies of your songs uploading.
    (12) As another means of confirmation, once several of the songs have uploaded, do an iOS device search for the album. You should  be able to get the album to appear before the upload is complete. You may have to back out of the search and back in to get it to work, but chances are when you first see the album, the song titles will all be grayed out.  Once the update is complete, give it a minute and everything should become available to you.
    (13) Pick a track that wouldn't play before and watch to see if the timer starts to move, followed by music! It is now time to do a little happy dance.
    I know this is a far cry from figuring out what it takes to get songs that should match to actually do so, but that's a whole different ball of wax.

    Thanks this was useful. I have been ripping my audiobooks and I was finding that they would get uploaded to iCloud in the process, which in itself was fine, but then iTunes would not let me change the media type to Audiobook, which is annoying as it effects how iTunes treats the media. Like showing you the skip back 10 seconds button.
    The general outline here helped me work around the issue and change the media type before the media was re-uploaded to iCloud.
    Sean

  • Unable to upload Files to child site collection using REST

    Dear All,
    I referred this article http://www.shillier.com/archive/2013/03/26/uploading-files-in-sharepoint-2013-using-csom-and-rest.aspx for uploading documents to SP Document Library and it works fine for any document library under the root site collection(
    for example "http://<server name>/Shared Documents" but when i upload the same document to one of the sub site collection created using Managed Path( the site collection path is "http://<server name>/files/Case" and the library
    name is "records") it fails and i get below error:
    The security validation for this page is invalid. Click Back in your
    Web browser, refresh the page, and try your operation again, Error Code -2130575251 Microsoft.SharePoint.SPException"
    Any help suggestion to resolve this? I've almost tried everything to resolve this issue but no luck.. appreciate any help
    for this..
    Regards,
    Vishal

    Hi,
    According to your post, my understanding is that you had an issue uploading files to subsite using REST.
    I had made a simple code demo below, it will upload a file to Document Library after you make your selection with the File control.
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    function uploadFile(){
    //alert(2);
    if (document.getElementById("file").files.length === 0) {
    alert('No file was selected');
    return;
    var parts = document.getElementById("file").value.split("\\");
    var filename = parts[parts.length - 1];
    var file = document.getElementById("file").files[0];
    uploadFileSync("http://YourSite", "Documents", filename, file);
    //Upload file synchronously
    function uploadFileSync(spWebUrl , library, filename, file)
    //alert(3);
    var reader = new FileReader();
    reader.onloadend = function(evt)
    if (evt.target.readyState == FileReader.DONE)
    var buffer = evt.target.result;
    var completeUrl = spWebUrl
    + "/_api/web/lists/getByTitle('"+ library +"')"
    + "/RootFolder/Files/add(url='"+ filename +"',overwrite='true')?"
    + "@TargetLibrary='"+library+"'&@TargetFileName='"+ filename +"'";
    $.ajax({
    url: completeUrl,
    type: "POST",
    data: buffer,
    async: false,
    processData: false,
    headers: {
    "accept": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val(),
    "content-length": buffer.byteLength
    complete: function (data) {
    //uploaded pic url
    console.log(data.responseJSON.d.ServerRelativeUrl);
    error: function (err) {
    alert('failed');
    reader.readAsArrayBuffer(file);
    </script>
    <input type="file" id='file' onchange="uploadFile()"/>
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected].
    Jason Guo
    TechNet Community Support

  • Uploading files a landing server using webutil

    dear all,
    i have the current situation and i'm looking for solution.
    i'm using the webutil in order to upload files from the client side to a landing server, the situation here is :
    when i use the following code
    webutil_file_transfer.Client_To_AS_with_progress
    (clientFile => :upload.file_name
    ,serverFile => 'd:\temp\'||l_bare_filename
    ,progressTitle => 'Upload to Application Server in progress'
    ,progressSubTitle => 'Please wait'
    ,asynchronous => false
    ,callbackTrigger => null
    where d:\temp is alocal directory on the AS
    but if i change the server file to a drive mapping i'll have the following error
    WUT-132, my question here is it possible for the webutil to upload a file to another landing server other than AS?
    how can i do it without making a hidden share to the folder ?
    the other question if i have a firewall between the client and the AS, will it prevent the webutil uploading process ?

    i want to add another point, when we make hidden share to the map drive the uploading worked successfuly.
    what i need here is a way to access the map drive without making hidden share to the map drive?

  • Problems with uploading file to database using FND_GFM

    Hi
    I'm having some problems uploading files to the database in apps 11.5.9
    As various sources/documents tell me, using the standard FND_GFM / FND_FILE_UPLOAD packages of APPS should transfer an uploaded file into the FND_LOBS table, but some reason it doesn't work. I copied and altered the FND_GFM.upload_confirm function to try and figure out why it doesn;t work and it looks like the file to be uploaded does not appear in the defined table (FND_LOBS_DOCUMENT).
    The following DAD is defined (with hidden password and servername to prevent abuse ;)):
    [DAD_oes_s]
    connect_string = oes_s
    password = ****
    username = APPS
    default_page = fnd_web.ping
    document_table = APPS.fnd_lobs_document
    document_path = docs
    document_proc =
    upload_as_long_raw =
    upload_as_blob = *
    reuse = Yes
    connmax = 10
    pathalias = fndgfm
    pathaliasproc = fnd_gfm.dispatch
    enablesso = No
    cgi_env_list=SERVER_NAME=***,REQUEST_PROTOCOL=http,SERVER_P
    ORT=***,HOST=***
    input_filtering = Yes
    stateful=STATELESS_RESET
    And I'm using the following code to generate the upload-file page
    CREATE OR REPLACE PROCEDURE XX_ITRIS_HelloWorld AS--(file IN VARCHAR2) AS
         access_id_v varchar2(1000);
         BEGIN
              htp.htmlOpen;
              htp.bodyOpen;
              htp.formOpen('http://***/pls/oes_s/fnd_file_upload.uploadcompletemessage', 'GET', null, 'multipart/form-data');
              htp.formFile('file');
              access_id_v := fnd_gfm.authorize(null);
              htp.formHidden('access_id', access_id_v);
              htp.formSubmit();
              htp.formClose;
              htp.line;
              htp.bodyClose;
              htp.htmlClose;
         END XX_ITRIS_HelloWorld;
    Can anybody point out what is going wrong?

    You said you are uploading XML file whereas in the TSQL you have assign as text file i.e @SourceFile = 'test.txt'. Are you sure that you are copying XML file ? What is the size of the source file "test.txt" ? I am sure it is 0 KB. That is what you
    have found in FTP site.
    Regards, RSingh

  • Uploading files in UCCX 8.0

    Hi,
         I'm trying to write a script based on the emergency evacuation script in the repository. I've found out all of the nasty "you should never use this way" things in the script and changed them so that the write file is now an auth user and upload file step. The problem is that the upload file step always hits the fail branch and I can't figure out why. I've tried deleting the original file (although it is set to overwrite) and that makes no difference and I'm authenticating as the same admin as uploaded the files in the first place. I'd appreciate any pointers.
    Thanks,
         Joe

    Rui,
    I've come across lot of such requests from Cisco partners & customers but as far as I know, automation of entire process is not possible as of yet. The call list needs to be manually imported to outbound campaigns by Admin, this can not be automated.
    Would love to hear some great ideas on this topic from great folks here.
    Pls rate the post if it helps.
    GP.

  • Returning back from viewing an Uploaded file

    Hi all,
    I have successfully created a page using OA Framework's File Upload/Download feature. It seems to work great except when I click on the hypertext 'View' to view the uploaded file, after viewing the file (.txt) I cannot go back to the Upload page.
    Back buttons give me an error. Is there a way to go back to the Upload page?
    Any ideas would be greatly appreciated.
    Thank you.

    What steps are needed to make this possible?
    Hi South,
    Welcome to the discussions and the AppleWorks forum.
    Essentially all you need to do is Save the file in a folder to which the 'User' logged in on the computer has Read access.
    AppleWorks files are always editable, so anyone opening the file on this machine will be able to make changes to it. You can't prevent the changes, but you can prevent them from being Saved by placing the file in a folder to which only the Owner has Write access, and Others have only Read access.
    As your OPAC machine is already connected to the server, it already has a 'User' account with which to make the connection. Whoever does the File server/Network administration in your building will know how to create a folder for which you (or whoever will make changes to the database) are the owner, with full Read/Write access, and the 'User' of the OPAC machine is a User or member of a Group with only Read access.
    Regards,
    Barry

  • Where are uploaded files spooled to?

    An arcane question regarding the custom version of Apache 1.3 included with OS X Server 10.4: when submitting a form including a file upload, I presume the file gets spooled into a temporary location on the server while it's being uploaded, correct? So, where is it (or how can I find out)?
    The thing is, I've been trying to write an "upload progress meter" for a mod_perl script, and it's not working -- there's something about this customized version of Apache that prevents any of my script's code from being executed until after the upload has completed (I have a similar CGI script with a progress meter running on a plain-OS X Mac mini at home, and it works just fine). I've tried CGI.pm's upload hooks, as well as Apache::Upload for mod_perl-specific ways to deal with this problem, but it never works: all of my code runs, but only after the upload itself has finished.
    I'm not willing to install another Apache or anything like that. So I figure one possible workaround is to find out where the file is being spooled, then have another script (called via XmlHttpRequest) periodically report the size of the temporary file back to the client. Does anyone know where uploaded files get stored while the upload is in progress?

    Ok I found my own answer.
    An uploaded excel file is stored on the server running the Hyperion Interactive Reporting Base Service under biplus\data\rm1_server name and then under some very long folder names with seemingly random numbers. The file itself is stored with a long alphanumeric name. You can lookup the file name in the BI plus relational database in the container table where you can find the long object name and the real file name.

  • Cannot upload file suddenly

    Hi
    I built a code to upload file and create directory. It did work yesterday. When I run it today, the file cannot be uploaded.
    <input type="file" name="myimage">
    enctype="multipart/form-data"
    boolean isMultipart = ServletFileUpload.isMultipartContent(request);
    if(isMultipart)
    DiskFileItemFactory factory = new DiskFileItemFactory(); //I added a breakpoint here, Source not found for WebappClassLoader.loadClass(String)               
    factory.setSizeThreshold(500000);               
    factory.setRepository(tempPathFile);
    ServletFileUpload upload = new ServletFileUpload(factory);
    upload.setSizeMax(1000000);     
    List /*FileItem*/ items = upload.parseRequest(request);
    Iterator /*FileItem*/ i = items.iterator();
    Why this happen?

    Ok "cannot be uploaded" is rather unspecific. What happens? Does your browser prevent you from pressing the "Upload"-Button? Are aliens intercepting your data? Do you get an exceptions? An error message? Anything?

  • Minimum filesize for uploaded file?

    One of the people in our department who is helping with course/content creation has brought up an interesting problem:
    For various reasons, up until now we have fed various pieces of video to our campus via a QT streaming server. Usually, we will embed a very small reference movie (usually around 4k) on a web page or in Blackboard. The reference movie will then kickstart the video stream. We have done this via podcasting in iTunes as well with success. When my colleague tried uploading one of the reference files into iTunesU, it acts as if it uploads, but will respond with a message stating : "0.00 of 0.00MB transferred" and the file never appears on the track list as it should. Other, larger files are uploading fine.
    So, my question is this:
    Is there some some sort of minimum size for an uploaded file? Is 4KB too small?
    and
    as a follow-up, will our stategy of using reference movies work within iTunesU? We know that the end-users will not be able to download the full video files.
    Thanks all
    Eric
    Dual 2GHz G5   Mac OS X (10.4.6)  

    One alternative you might consider is using a link on
    the iTunes U page. You could link to a page with the
    stream or to the stream itself with an http url.
    Links allow you to access any related content via a
    web browser.
    That is an option, but the idea here is to encourage the use of iTunes U to faculty and students as a media portal, and to encourage the use of iTunes in general. So basically, what I'm trying to accomplish is to argue why this needs to be a feature, instead of disabling it.
    I'll gladly argue the point with anyone that wants to take the side of the iTunes application NOT being a media player. I love Apple products, and I cringe at the notion of forcing our users to use Real to access academic streaming content from our Quicktime Streaming Server.
    It just doesn't make sense to force them to get some media files one way (using the "Get Song" button), and some (also Quicktime files) using a different metaphor. In fact, it goes against the metaphor of the entire iTunes Music Store interface of simply clicking the "Get" button to acquire the content.
    If the service only goes half way, there is little point in creating links on the iTunes U page linking back to a page referencing the streaming media. We (IT services on our campus) want to encourage the use of iTunes U, but why should we have users go to iTunes U to download the content when we could just post the links and content we would otherwise post within iTunes U within Blackboard, or as a podcast.
    Last fall we hosted a live event that we made accessible via our Quicktime Streaming server. I embedded a reference .mov file into one of our podcast feeds in iTunes (not iTunes U) so users could watch the even live within iTunes. Streaming... So it can be done. But iTunes U specifically prevents this format of a Quicktime .mov file from being uploaded.
    It would make my job much easier to advocate the use of iTunes as our campus media portal.
    Mark Leaman
    New Media Consultant
    Bowdoin College
    Brunswick, Maine
    207-725-3512
    17" iMac G5   Mac OS X (10.4.7)  

  • Deleting Uploaded file

    Hi,
    I've used af:inputFile to upload the files to a location in my PC.
    How can I give the user flexibility to delete the uploaded file.
    Thanks,
    Satya

    Id that a question or the answer?
    I guess you answered your own question here. If the user decides to remove a row in a table which contains a link to a file in the file system, you as the designer are responsible to delete the file.
    This you can do if you overwrite the doDML() method of the EO in question.
    On the other hand why do you store the files in the file system? This causes trouble (believe me, it will). You can store the files in a blob column and they are gone when you remove the row.
    Timo

Maybe you are looking for

  • BT Infinity Installed, and getting around same spe...

    Hi there, I had BT Infinity installed on the 19/3/12 and have currently been getting around roughly the same down speeds as my old BB package at 20mbps (roughly averaging out between 15mbps and 19.xx Down) My upload speeds are really good and have se

  • Why can I not get a pdf with images work with quick look in the ipad

    Why can I not use the Quick Look function when I view a pdf with images, on my Ipad?

  • How to get name of my machine ?

    Could someone please give a code snippet on how to find out the name of my computer ? By name, I don't mean the IP-Address. As for example, my computer name is Pluto, and I want to write Java-code to get it. Cheers /Andreas

  • Quick question, re: bent pins on hard drive connector...

    When replacing my hard drive I slightly bent 4 of the small pins on the back of the new hard drive. I tried bending them back slightly but the connector was able to fit over them, so I just ended up leaving as is... My question is, will these "bent p

  • Mexico Payroll

    Hi! All We are working on the Mexican Payroll. We have run the payroll earlier it was running successfully but now with a new hiring of employees there is an error.i.e. No entry in table T512W for key 32 /484 for time 31.01.2007 But the point is /484