I'm developing a web application built on top of SharePoint 2013 using HTML, JavaScript and JQuery but I'm having trouble trying to figure out how I can upload large files onto a SharePoint Document Library. I already know how to upload files that are <= 1.5 MB using JSOM but I need to upload files larger than that. I came across this documentation:
but I get errors at
appWebUrl = decodeURIComponent(getQueryStringParameter('SPAppWebUrl'));
hostWebUrl = decodeURIComponent(getQueryStringParameter('SPHostUrl'));
>> Cannot read property 'split' of undefined
and a
403 FORBIDDEN
To fix the first issue, I tried
var hostUrl = _spPageContextInfo.siteAbsoluteUrl;
var appweburl = _spPageContextInfo.webAbsoluteUrl;
but it gives me an error saying _spPageContextInfo is undefined.
To attempt fixing the 403 FORBIDDEN error, I tried changing
'X-RequestDigest': jQuery('#__REQUESTDIGEST').val()
to
'Authorization': 'Bearer '+ digest
but it prompts me to log into SharePoint with a username and password. When I enter in my info, nothing happens.
I'm not sure if this will help but my script is in this order:
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"></script>
<script type="text/javascript" src=".../_layouts/1033/init.js"></script>
<script type="text/javascript" src=".../_layouts/sp.core.js"></script>
<script type="text/javascript" src=".../_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src=".../_layouts/15/sp.js"></script>
<script type="text/javascript" src=".../_layouts/15/SP.RequestExecutor.js"></script>