ASP Upload Component - Classic ASP - file-upload

I have just moved a site from a dedicated server to a GoDaddy shared hosting account, and have just encountered loads of problems! One being with ASP Upload.
In Classic ASP, this is what I would normally do to upload files to my folder:
Set upload = Server.CreateObject("Persits.Upload")
uploadPath = Server.MapPath("../../files/photos/"&token_&"/")
upload.IgnoreNoPost = True
upload.Save(uploadPath)
Set upload = Nothing
But since moving to GoDaddy, I get this nasty message:
This feature has been disabled by the system administrator. Use SaveVirtual instead.
I went on to ASP Upload's website documentation and I could not find SaveVirtual, only SaveAsVirtual which is where I have become unstuck.
I tried using SaveAsVirtual but it threw an error stating that I was using a physical path and I should be using a virtual path! I really don't understand this and was hoping that somebody could put me straight. My website is now deemed broken and is offline, please help.
This is what I tried before the physical/virtual path error:
Set upload = Server.CreateObject("Persits.Upload")
uploadPath = Server.MapPath("../../files/photos/"&token_&"/")
upload.IgnoreNoPost = True
upload.SaveAsVirtual(uploadPath)
Set upload = Nothing

According to the docs, the method is named SaveVirtual. It does the Server.MapPath conversion for you.
So, try:
Set upload = Server.CreateObject("Persits.Upload")
uploadPath = "../../files/photos/"&token_&"/"
upload.IgnoreNoPost = True
upload.SaveVirtual(uploadPath)
Set upload = Nothing

You already set a folder path to upload not need use like this "server.mappath"
please use below of code.
Set Upload = Server.CreateObject("Persits.Upload" )
Upload.SetMaxSize 10000000 ' Maksimum dosya büyüklüğü Byte cinsinden
Upload.OverwriteFiles = True
Path = "../../duyurular/"
Count = Upload.SaveAsVirtual(Path)

for godaddy you have to go in and change the server folder permission to read/write. Otherwise you get that error message.

well I also get encounter with this problem, I just changed the folder privileges from Go-daddy Hosting server so Any one can read or Write file from specific location
Many Thanks
Ahsan Aziz Abbasi

Related

VB.net download file via ftpwebrequest -> directory topic?

I need to download a file from a FTP Server.
The path and the file name is
ftp://10.17.20.60/ata0b/OpconData/StationData/Station.dat
When i want to see all Files in the StationData directory i use
Dim request As Net.FtpWebRequest = Net.FtpWebRequest.Create("ftp://10.17.20.60/%2F/ata0b/OpconData/StationData/")
request.Method = Net.WebRequestMethods.Ftp.ListDirectory
request.Credentials = New Net.NetworkCredential(form1.txtFTPUser.Text, form1.txtFTPPasswort.Text)
Dim response As Net.FtpWebResponse = request.GetResponse()
With this i get the content of the directory. Of course i see the Station.dat file. I was able to make it work since i use the %2F parameter to change the directory to ata0b.
So far so good!
Now i want to download the Station.dat file. But i always get an error (550) File unavailable (e.g., file not found, no access) at the last line in code below.
My code looks like this:
'Create Request To Download File'
Dim wrDownload As FtpWebRequest = WebRequest.Create("ftp://10.17.20.60/%2F/ata0b/OpconData/StationData/Station.dat")
'Specify That You Want To Download A File'
wrDownload.Method = WebRequestMethods.Ftp.DownloadFile
'Specify Username & Password'
wrDownload.Credentials = New NetworkCredential("opconadmin", "OpconAdmin")
'Response Object'
Dim rDownloadResponse As FtpWebResponse = wrDownload.GetResponse()
What's my failure? In my point of view the file must be at the given path. I really hope somebody can give me a hint.
BR
Steffen
The error means what it says.But let me explain why this might occur :
1 • The file might be unavailable/not present on the server
2 • You might face 'Security Problem on file' issue .
There could be other causes like server timeout or other..
However,you need to find out what the error message really is.TO do this, you can use a TRY-CATCH statement. E.g.
Try
'YOur code here
Catch e as WebException
Msgbox(e.Message) 'you can use e.tostring for more details
After you find out what exactly is the problem,then you'ld be able to solve it.Take a look at these :
http://www.dreamincode.net/forums/topic/76361-file-upload-to-server/
https://nickstips.wordpress.com/2010/10/25/c-ftp-upload-error-the-remote-server-returned-an-error-550-file-unavailable-e-g-file-not-found-no-access/
https://forums.asp.net/t/1777881.aspx
But one thing i'ld like to suggest is to check whether you have any Permission/Security issues or not.And after you get the exact error message,it may(or may not) turn out to be that you don't have enough disk space.However,try my solution and leave a reply for further assistance.
UPDATE
Try replacing the FTP link with this : ftp://10.17.20.60//ata0b/OpconData/StationData/Station.da

Using Leigh version of S3Wrapper.cfc Can't get past Init

I am new to S3 and need to use it for image storage. I found a half dozen versions of an s2wrapper for cf but it appears that the only one set of for v4 is one modified by Leigh
https://gist.github.com/Leigh-/26993ed79c956c9309a9dfe40f1fce29
Dropped in the com directory and created a "test" page that contains the following code:
s3 = createObject('component','com.S3Wrapper').init(application.s3.AccessKeyId,application.s3.SecretAccessKey);
but got the following error :
So I changed the line 37 from
variables.Sv4Util = createObject('component', 'Sv4').init(arguments.S3AccessKey, arguments.S3SecretAccessKey);
to
variables.Sv4Util = createObject('component', 'Sv4Util').init(arguments.S3AccessKey, arguments.S3SecretAccessKey);
Now I am getting:
I feel like going through Leigh code and start changing things is a bad idea since I have lurked here for year an know Leigh's code is solid.
Does any know if there are any examples on how to use this anywhere? If not what I am doing wrong. If it makes a difference I am using Lucee 5 and not Adobe's CF engine.
UPDATE :
I followed Leigh's directions and the error is now gone. I am addedsome more code to my test page which now looks like this :
<cfscript>
s3 = createObject('component','com.S3v4').init(application.s3.AccessKeyId,application.s3.SecretAccessKey);
bucket = "imgbkt.domain.com";
obj = "fake.ping";
region = "s3-us-west-1"
test = s3.getObject(bucket,obj,region);
writeDump(test);
test2 = s3.getObjectLink(bucket,obj,region);
writeDump(test2);
writeDump(s3);
</cfscript>
Regardless of what I put in for bucket, obj or region I get :
JIC I did go to AWS and get new keys:
Leigh if you are still around or anyone how has used one of the s3Wrappers any suggestions or guidance?
UPDATE #2:
Even after Alex's help I am not able to get this to work. The Link I receive from getObjectLink is not valid and getObject never does download an object. I thought I would try the putObject method
test3 = s3.putObject(bucketName=bucket,regionName=region,keyName="favicon.ico");
writeDump(test3);
to see if there is any additional information, I received this :
I did find this article https://shlomoswidler.com/2009/08/amazon-s3-gotcha-using-virtual-host.html but it is pretty old and since S3 specifically suggests using dots in bucketnames I don't that it is relevant any longer. There is obviously something I am doing wrong but I have spent hours trying to resolve this and I can't seem to figure out what it might be.
I will give you a rundown of what the code does:
getObjectLink returns a HTTP URL for the file fake.ping that is found looking in the bucket imgbkt.domain.com of region s3-us-west-1. This link is temporary and expires after 60 seconds by default.
getObject invokes getObjectLink and immediately requests the URL using HTTP GET. The response is then saved to the directory of the S3v4.cfc with the filename fake.ping by default. Finally the function returns the full path of the downloaded file: E:\wwwDevRoot\taa\fake.ping
To save the file in a different location, you would invoke:
downloadPath = 'E:\';
test = s3.getObject(bucket,obj,region,downloadPath);
writeDump(test);
The HTTP request is synchronous, meaning the file will be downloaded completely when the functions returns the filepath.
If you want to access the actual content of the file, you can do this:
test = s3.getObject(bucket,obj,region);
contentAsString = fileRead(test); // returns the file content as string
// or
contentAsBinary = fileReadBinary(test); // returns the content as binary (byte array)
writeDump(contentAsString);
writeDump(contentAsBinary);
(You might want to stream the content if the file is large since fileRead/fileReadBinary reads the whole file into buffer. Use fileOpen to stream the content.
Does that help you?

DHTML Scheduler .NET change path script and style files

I started experimenting with DHTMLX Scheduler .Net but encountered some 'issues'.
I like to have everything ordered at my own way (css files in folder 'styling', js files in folder 'scripts', ...)
But now it seems like using this dll forces me to place everything in a folder that they chose. So when I init the Scheduler on my page, it automatically tries to call this files:
/Scripts/dhtmlxScheduler/dhtmlxscheduler.js
/Scripts/dhtmlxScheduler/dhtmlxscheduler.css
/Scripts/dhtmlxScheduler/locale/locale_nl.js
I would like to change these paths to for example '/scripts/dhtmlxscheduler.js' but I can't find a property in the Scheduler object where I'm able to do this.
Is this possible or do I have to put everything in the folder they would like to have it?
My working code thisfar:
Public Scheduler As DHXScheduler
Scheduler = New DHXScheduler()
Scheduler.InitialDate = New DateTime(Now.Year, Now.Month, Now.Day)
Scheduler.InitialView = "day"
Scheduler.Config.first_hour = 6
Scheduler.Config.last_hour = 20
Scheduler.Config.time_step = 30
Scheduler.Config.limit_time_select = True
Scheduler.Localization.Set(SchedulerLocalization.Localizations.Dutch)
Scheduler.DataAction = Me.ResolveUrl("/Handlers/Scheduler_Data.ashx")
Scheduler.SaveAction = Me.ResolveUrl("/Handlers/Scheduler_Save.ashx")
Scheduler.LoadData = True
Scheduler.EnableDataprocessor = True
I would like to find the possibility to set such a property to my own filepath, if possible ..
thx in advance
Further research showed me that I could change the default location with this line of code:
Scheduler.Codebase = "/js/dhtmlxscheduler"
However, this only sets the rootfolder, so all the files have to be located within this folder. I helped myself out by putting empty files over there and call my own styling and scripting from the location I wanted (just to get rid of the console errors).
So this solved my problem (as far as it could be solved).

VBscript - How do I change anonymous authentication settings for a specific site?

I'm writing a VBscript that I would like to alter the anyonymous authentication configuration for a specific site on my web server. However, I'm unsure of how this is done in the commit path. Currently, I am able to change the setting on a global scale, but I only want to target one particular site folder. My best guess was to simply include the site path at the end of MACHINE/WEBROOT/APPHOST.
'CHANGE ANONYMOUS AUTHENTICATION GLOBALLY (working code):
Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
Set anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST")
anonymousAuthenticationSection.Properties.Item("enabled").Value = True
anonymousAuthenticationSection.Properties.Item("userName").Value = "myUser"
anonymousAuthenticationSection.Properties.Item("password").Value = "myPass"
adminManager.CommitChanges()
'MY BEST GUESS AT TARGETING A SPECIFIC SITE (returns error 80070005):
Set anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST/Sites/InsideFTL/Corp/redirects/netXposure")
The code that you have above should work, are you running it from an elevated command prompt?
You could also try to make sure that it is committing to ApplicationHost.config to make sure it is not a locking issue by setting CommitPath, and make sure that the identity under you are running the script has write access to it.
'CHANGE ANONYMOUS AUTHENTICATION For Default Web Site:
Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site")
anonymousAuthenticationSection.Properties.Item("enabled").Value = True
anonymousAuthenticationSection.Properties.Item("userName").Value = "myUser"
anonymousAuthenticationSection.Properties.Item("password").Value = "myPass"
adminManager.CommitChanges()

"The directory name is invalid" error on Process.Start?

I am writing a launcher program, and when I go to start the process I get the "The directory name is invalid" error. Here is the code that is launching the process:
Const DEBUG_ROOT = _
"Z:\Kiosk_JC\KioskSignIn.root\KioskSignIn\KioskSignIn\KioskSignIn\bin\Debug"
Dim oKiosk As New System.Diagnostics.Process
oKiosk.StartInfo.UserName = oEnc.Decrypt(Username)
oKiosk.StartInfo.Password = oEnc.DecryptSecure(Password)
oKiosk.StartInfo.Domain = oEnc.Decrypt(Domain)
''// The AddBS function appends a '\' to the passed string if it is not present
oKiosk.StartInfo.WorkingDirectory = AddBS(DEBUG_ROOT)
oKiosk.StartInfo.FileName = "KioskSignIn.exe"
oKiosk.StartInfo.UseShellExecute = False
Dim proc As Process = Nothing
proc = System.Diagnostics.Process.Start(oKiosk.StartInfo)
I saw on another question here that I needed to set the WorkingDirectory (before I started searching I was getting the error). Even though I have this property set, I am still getting the error. Any thoughts?
More info
I should also note that my Z:\ is a on my network. I have a function that resolves a path to UNC. When I ran this function on DEBUG_ROOT, I get the same error.
I tried moving the application to c:\kiosk. Same result. I am logged in as the user I am impersonating, so I have access to all shares and files.
Here is the link, for some reason the URL formating wants to consume all the text after the link is designated:
Referred Post
Mapped drives are per-user. You are likely starting the process with a different user.
Sounds like the process can't see the Z: drive or doesn't have security access. What user context does the app run under? Perhaps the Z: drive is not available in that context.
I got the same error as you do. most likely the user you use to run the process does not have access to specified resource (exe file)
try to move your exe to some other location and/or give your user access rights to the file.