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

Similar Messages

  • Call Parent Site collection webpart in to child site collection

    Dear All, 
    Before we did the same practice with 2010, to display the customer list from parent site collection in to child site, but in 2013 i did not find the option in the site setting. 
    I did not find how can i call the parent site collection webpart (custom document library) in to child site collection 
    If any one know please inform me 
    Make sure i am discussing about SP 2013 
    Regards 
    Rashid Imran Bilgrami 

    I found an answer for it 
    First open the webpart in to sharepoint designer (Make sure the webpart is mark as Server Render in the webpart property) 
    Then you will see the List View Web Part tab 
    Select Web Part  Tab under it 
    Then Select to site gallery or save to file 
    I have a detail discussion here related to it 
    http://social.msdn.microsoft.com/Forums/office/en-US/aa13d6f0-fa77-493d-a610-35e8ddf6981d/sharepoint-designer-2013-no-design-view-ufff?forum=sharepointcustomization 

  • Unable to upload files via admin & FTP

    I've been trying to upload files to this site, but it keeps on bringing errors. It worked fine 20 minutes ago. Now the FTP doesn't upload and the Admin File Manager brings back errors on upload as well. Anyone know what's going on? The system status gives all green dots about all servers and doesn't say anything about disabled FTP or File Upload: http://status.businesscatalyst.com/

    There was scheduled maintenance today. But the status page doesn't have anything about what is going on. The last update was three hours ago saying hotpatch deployment was competed.

  • Unable to upload files via Wi-Fi.

    My phone C3-00 is running on latest update v08.71. I'm unable to upload files on wi-fi. When I start any service like Facebook on opera mini or any browser (I'm also unable to use Mail & Communities via wi-fi) and try to upload file (pic. of max. size 500KB) it shows uploading two times then shows connection failed. I tried it several times but everytime it shows connection failed. But I can easily upload files via GPRS. The Mail & Communities app also runs fine on GPRS but not works on Wi-Fi. Please solve my problem.

    Read my previous post /t5/Phone-Applications/Nokia-apps-on-Wi-Fi/m-p/1305667#M25965

  • Allowing people to upload file to my site

    Hi
    I want to allow people who visit my website to be able to upload files to my site.
    I know how to make the form with the “browse” button in DW but what exactly do I do after that?
    Can anyone instruct me which script I need to have, where to put them, on my server and what else to do for the upload process to succeed?
    Thank you

    Hi,
    you could have a look here:
    How to let users upload files to server: http://forums.adobe.com/thread/857391?tstart=0
    For simple exchange of large files try a 3rd party email service:
    https://www.yousendit.com/
    http://www.dropsend.com/
    http://www.dropbox.com/ (large files)
    http://www.google.com.au/search?q=email+large+files
    Hans-Günter

  • Creating new site collection using wsp template fails

    Hi all,
    I'm creating new site collections using a wsp solution generated by "save as template".
    For site collection creation I select "<Select template later>" then I upload the wsp solution.
    Everything worked until last month, now after CU installation (agoust 2014) I get an error:
    "List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user."
    Does anyone know how to solve it?
    Thanks 
    Maurizio

    ULS contains a lot of those errors:
    System.IO.FileNotFoundException: <nativehr>0x80070002</nativehr><nativestack></nativestack>, 
    StackTrace:
         in Microsoft.SharePoint.SPWeb.GetList(String strUrl)
         in Microsoft.SharePoint.SPWeb.TryGetListByUrl(String url)
         in Microsoft.SharePoint.SPFieldElement.PerformFixUpIfLookUpField(Guid fieldId, XmlNode xmlNodeOfAField, SPWeb web)
         in Microsoft.SharePoint.SPFieldElement.ElementActivated(SPFeaturePropertyCollection props, SPSqlCommand sqlcmdAppendOnly, SPWebApplication webApp, SPSite site, SPWeb webNull, Boolean fForce)
         in Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionFieldsAndContentTypes(SPFeaturePropertyCollection props, SPSite site, SPWeb web, SPFeatureActivateFlags activateFlags, Boolean fForce)
         in Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, SPFeatureActivateFlags activateFlags, Boolean fForce)
         in Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce)
         in Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly)
         in Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, Int32 compatibilityLevel, String featureName, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean
    fMarkOnly, Boolean fIgnoreMissing, SPFeatureDefinitionScope featdefScope)
         in Microsoft.SharePoint.SPFeatureManager.EnsureFeaturesActivatedCore(SPSite site, SPWeb web, String sFeatures, Boolean fMarkOnly, Boolean fIgnoreMissing)
         in Microsoft.SharePoint.SPFeatureManager.<>c__DisplayClass7.<EnsureFeaturesActivatedAtWeb>b__6()
         in Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param)
         in Microsoft.SharePoint.SPFeatureManager.EnsureFeaturesActivatedAtWeb(Byte[]& userToken, Guid& tranLockerId, Int32 nZone, Guid databaseid, Guid siteid, Guid webid, String sFeatures, Boolean fIgnoreMissing)
         in Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, Int32 fIgnoreMissingFeatures, String&
    bstrWebTemplate, Int32& plWebTemplateId)
         in Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, Int32 fIgnoreMissingFeatures, String&
    bstrWebTemplate, Int32& plWebTemplateId)
         in Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, Int32 fIgnoreMissingFeatures, String& bstrWebTemplate,
    Int32& plWebTemplateId)
         in Microsoft.SharePoint.SPWeb.ProvisionWebTemplate(SPWebTemplate webTemplate, String webTemplateToUse, SPFeatureWebTemplate featureWebTemplate, Page page, SPFeatureDependencyErrorBehavior featureDependencyErrorBehavior, ICollection`1&
    featureDependencyErrors)
         in Microsoft.SharePoint.SPWeb.ApplyWebTemplate(SPWebTemplate webTemplate, Page page, SPFeatureDependencyErrorBehavior featureDependencyErrorBehavior, ICollection`1& featureDependencyErrors)
         in Microsoft.SharePoint.SPWeb.ApplyWebTemplate(String strWebTemplate)

  • How to extract audit log data from every document library in site collection using powershell?

    Hi All,
    I have n number of document library in one site collection,
    My query is- How to extract audit log data from every document library in a site collection using powershell?
    Please give solution as soon as possible?

    Hi inguru,
    For SharePoint audit log data, These data combine together in site collection. So there is no easy way to extract audit log data for document library.
    As a workaround, you can export the site collection audit log data to a CSV file using PowerShell Command, then you can filter the document library audit log data in Excel.
    More information:
    SharePoint 2007 \ 2010 – PowerShell script to get SharePoint audit information:
    http://sharepointhivehints.wordpress.com/2014/04/30/sharepoint-2007-2010-powershell-script-to-get-sharepoint-audit-information/
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Delete site collection using Client object model

    Is it possible to delete a site collection using Client object model?
    -Prashant

    I don't think you can create or delete a site-collection using SharePoint Client Object Model. You'd need to leverage admin web services (
    http://Site/_vti_adm/Admin.asmx) (or) server-side object model (or) powershell for this task.
    Please mark the replies as answers if they help or unmark if not.

  • How can i upload files in servlets and also using jsp

    means that uploading files(.doc) or any files by using servlets and jsps

    yawmark wrote:
    saichand wrote:
    means that uploading files(.doc) or any files by using servlets and jsps
    [http://www.google.com/search?q=How+can+i+upload+files+in+servlets+and+also+using+jsp]
    ~Good topic titles are indeed brilliant search keywords. It's sad to see that it won't even come in the mind of the topicstarters to Google it before posting the topic.

  • How to provision site collection using CSOM in SharePoint on premise

    Hi,
    I need to create site collection using CSOM in SharePoint on premise.
    Most of the forums discuss on provisioning site collection in SharePoint online and that does not work in on premises.
    Is it possible to provision site collection using CSOM in on premise?
    Kindly, share some reference to accomplish this.
    Thanks in advance,
    Dhijit

    Hi,
    According to your description, my understanding is that you want to create a site collection using Client Object Model in SharePoint on-premise environment.
    One option is that you can follow the article below to create the site collection with CSOM.
    Provisioning site collections using SP App model in on-premises with just CSOM 
    Another option,  I suggest you can use admin web service for SharePoint 2013 to create a site collection.
    Here is a detailed article for your reference:
    Admin.CreateSite method
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Unable to upload files from local computer to remote server (Was: Dreamweaver)

    I have lost the connection between the remote location and the local location for files on my computer. Where to I correct this issues, since I cannot upload files from local to remote. Host server from server to my computer works fine, Running Dell computerr XP operating system with CS3 Dreamweaver. Need all the help I can get.

    I am now having a "ftp error - cannot make connection to host. Dreamweaver
    encoutered a netwoerk or file system error. I did as you suggested and I
    get to basic site definition, ( which looks o.k.), next screen ( no,I do
    not want to use a server technology) Next screen ( edit local copies on my
    machine ( file location looks o.k.), next screen (connect to remote
    server=ftp) address of web server is correct, ( no folder on server, or ftp
    login or ftp password) do not enable check in or check out
    summary: local
    Site name:midhba
    local root folder:midhba
    remote info:
    access; ftp
    FTP host: midhba.com
    check in.check out diabled
    testing server (set up later)

  • I am unable to upload files via web browser

    Good morning
    I have just upgraded to Mavericks (10.9.5), and I am running into a weird issue. I am unable to upload any files via the web browser. If I go to a website, and select an Upload File option, I am taken to Finder, where I am able to select the file, and press attach. The issue comes when I press upload on the website. It always either times out, or gives me an error that I was disconnected from the server. This happens on Safari, Firefox, and Chrome. I'm not sure what to do... I've repaired disk permissions and tried a lot of different security settings, but I am stumped.
    Thank you

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    The title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen. Click the Clear Display icon in the toolbar. Then take one of the actions that you're having trouble with. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    Some private information, such as your name, may appear in the log. Anonymize before posting.

  • Unable to upload files to server via Transmit (ftp client)

    Hi For some reason I am no longer able to upload files via Transmit to my website server. I have built several sites hosted on different servers and I cant access any of them, so it is obviously a problem at my end. The Message I get when I try to connect is .... 'Server said authentication failed'.
    I used to have no problems with access. The only thing that has physically changed in my setup is that I am now running my computer directly from the Modem (D-Link DSL 300T) through the Ethernet port as my airport express decided to blow up a couple of months ago. I have also done several apple software updates, so I dont know if this has affected it. My firewall is on, but I have ftp access ticked. Can anyone please help, I dont know what else to try.
    Many Thanks
    Rob

    How would I access the server security logs?
    That would depend on the OS and your level of access. If it's a Linux server you would want to check the ftp entries in /var/log/secure as that is where authentication failures are logged. If it's a web hosting account on a shared server you may need to ask your support contact where your ftp logs are located.
    You might try connecting manually using the ftp command in the terminal window. If you can log in that way, the problem is most likely with your Transport settings. If you can't log in that way, you may at least get a more detailed error message.

  • 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

  • Help with uploading files to remote site

    I am trying to upload files onto a remote site, but it keeps
    timing out. Also, on my new website that i'm making for a client,
    when i Put the files onto the remote site it says Started:
    5/30/06 7:57 PM
    index.html - error occurred - An FTP error occurred - cannot
    put index.html. Access Denied. The file may not exist, or there
    could be a permission problem.
    File activity incomplete. 1 file(s) or folder(s) were not
    completed.
    Files with errors: 1
    index.html
    Finished: 5/30/06 7:57 PM
    What does this mean? why are the file incomplete?
    Mike S

    Have you successfully uploaded to this site before?
    Is your site definition configured to upload to the proper
    remote folder?
    The error message is simply telling you the transfer did not
    succeed
    "mikesilverman22" <[email protected]> wrote
    in message
    news:e5im76$r17$[email protected]..
    >I am trying to upload files onto a remote site, but it
    keeps timing out.
    >Also,
    > on my new website that i'm making for a client, when i
    Put the files onto
    > the
    > remote site it says Started:
    >
    > 5/30/06 7:57 PM
    >
    > index.html - error occurred - An FTP error occurred -
    cannot put
    > index.html.
    > Access Denied. The file may not exist, or there could be
    a permission
    > problem.
    >
    > File activity incomplete. 1 file(s) or folder(s) were
    not completed.
    >
    > Files with errors: 1
    > index.html
    >
    > Finished: 5/30/06 7:57 PM
    >
    > What does this mean? why are the file incomplete?
    >
    > Mike S
    >

Maybe you are looking for

  • How do i make a app on my macbook air 13" with netbeans

    netbeans is a development tool for (mac os x intel ) windows and linux os but every time i try to use the app i created it says this is no longer ppc supported

  • MacBook Pro won't boot up after Lion upgrade

    I upgraded my 13" macbook pro to lion last night. I watched some movies until the battiery died. Now it won't boot up. Indicator light does not come on and it makes no noise. Battery indicator says it's full. Any suggestions?

  • How to create a info structure for product allocation functionality

    Hi Experts, how to create a info structure for product allocation functionality For allocating fixed quantities to the specified customers at sales order Especially i need help in selecting the key figures and key charecterstics for at mc21 and mc24

  • If battery is in palce Powerbook G4 does not start

    Hello, I just had to change to AC adapter/recharger Now my Powerbook G4 1.67 dual lawyer will not start if a battery is in its compartment tha fan goes wild for a minute of so then it shuts down However, if no battery in the compartment, and plugged

  • Iphone died and won't charge.

    I updated my iPhone back in September to the iPhone 4 and have had absolutely no problems with it untillm y battery became low and proceded to turn off and now it won't charge or turn back on and I don't know what to do or whats happened??