Error 105 when creating and writing to text file - delphi

I am testing a login and account creation program. When the user presses the Create New Account button it prompts them to enter a Username (which saves to a variable-sNewUsername) and a Password (which saves to a variable-sNewPassword).
The password is saved to a text file.
For some reason, it gives me the 'I/O Error 105' when trying to save the password to the text file.
I have run the debug tool and it saves to the variable fine but does not Write to the text file.
I have double checked if I have used Rewrite instead of Reset and all looks fine.
AssignFile(tf,sNewUsername + '.txt');
Rewrite(tf);
writeln(sNewPassword);
closefile(tf);
I expected the file to save the Password from the variable to the text file but it does not write the password to the text file and give an error i do not understand ('I/O error 105').

Your call to writeln is not providing a file object, and so attempts to write to the standard output, which presumably does not exist in your process.
Change it to
writeln(tf, sNewPassword);
However, you should probably use a more modern mechanism to write a file. Further, you are running a serious risk that you won't write the file to the desired directory because you only specify a relative path.

Related

Geocortex Workflow Designer Upload File

i was tring to create a workflow with geocortex workflow designer that upload a file in folder.
So to do that, i create a Form that make a file picker and it returns a IList of FileItem.
than i would take the base64 data and write a file, but it show me an error:
Geocortex.Forms.Client.FileItem.Friend Property FileDataBase64 As
String is not accessible in this context beacause it is 'Friend'
the scope of my variable its Flowchart and i can't understand why this error
this error is showned even if i try to access te variable inside the form activity even outside.
thank's every one
It is probably a security related issue.
Make sure that your target directory is writeable by Geocortex workflow. Do a very basic test.
Again do every steps of the process in isolation, in order to pin-point the source of the problem. Poliart.com

HttpContent.ReadAsMultipartAsync leaves behind a temporary file

I'm starting to go loopy on this one, which normally means I'm missing something obvious.
I have the following code in my .NET MVC controller:
var provider = new CustomMultipartFileStreamProvider("prefix", GetRepositoryTempFolder());
await request.Content.ReadAsMultipartAsync(provider);
The CustomMultipartFileStreamProvider inherits from MultipartFileStreamProvider, overrides the GetLocalFileName method and returns an appropriate file name for a given ContentDisposition header. The HttpContent handled is normally a PDF file and a small JSON settings component.
Everything works wonderfully as far as getting the parts parsed, extracted and saved in the expected location. However, after parsing I end up with a temporary file left over in my C:\Windows\Temp folder. The file has a randomly generated name (e.g. zf0hk2h4.ks2). It has the same size and creation date as the PDF portion parsed and saved by ReadAsMultipartAsync.
I believe ReadAsMultipartAsync uses this temporary file during parsing and leaves it behind. Has anyone else experienced this? Any way I can prevent ReadAsMultipartAsync from leaving this temporary file behind and clogging up the Windows temp folder?
My apologies; I was missing something. The file was being moved after processing. This is an invalid question; there is nothing wrong with ReadAsMultipartAsync.

squeak error: cannot write a read-only file

I am trying to write a new method in Squeak. I click on the "no messages" to create a new method but any change to the existing template produces the error
"Error: cannot write a read-only file"
Squeak comes with an .image file and a .changes file. You must ensure that both are writable at development time. In particular, each time you save a method it will be written to the changes file.

Grails file upload with image name

I have a grails controller to handle uploaded files.
Now the problem is that i dont know by which name user will upload the file.
request.getFile(fileName)
I dont know the 'fileName'.
Please let me know how to handle anonymous file upload. These files are being uploaded from a javascript rich text editor and the name of the file input is comes different with each request.
Please help.
you should dump the parmas and inspect which is varible is holding the filename it might not be the varible filename holding the actual file name. so , if u dont have the file name you would have the file handle to proceeed uploading so do as follow :
1.DUMP parmas like
log.debug("Value of Parmas"+parmas.each{it.value()})
or
println("Value of Parmas"+parmas.each{it.value()})
on your console window or what ever using the browser look for a common name that you will use further to get the file handle usually called 'filename'.

Python kivy filechooser reads wrong path

I'm trying to use Kivy as a GUI for my python app, which needs to read a file from the filesystem.
However, in some cases the kivy filechooser read wrong path or nothing causing an IndexError while I'm trying to set the read path for a text of a textfield.
I use the default example for reading files learned from http://kivy.org/docs/api-kivy.uix.filechooser.html
The relevant part of my app is in this function, where an exception handling is added as a not a good approach to handle this :)
def load(self, path, filename):
'''
this will load the file and dismiss the dialog
'''
print "Loading file..."
print "filename:",filename
print "path:",path
try:
self.selected_file = filename[0]
self.file_text_input.text = self.selected_file
self.dismiss_popup()
except IndexError as ie:
print "Something made a boo-boo...try again"+str(ie)
self.dismiss_popup()
self.show_popup("ERROR","Somehow I couldn't load the file:\nCheck the permissions or move it to other place")
self.show_popup() is just a helper function, which shows a popup with the set function params.
The basic error is that filename[0] will throw an IndexError since it does not read the correct path.
I'm using Linux with python2.7, and somethimes when I select a file in my home folder, the filename variable stores nothing, while path variable stores misteriously a random folder, for instance, /media, /opt, etc.
Did anyone meet this issue?
I found out why it was handled uncorrectly.
All the failures are caused by Kivy's
FileChooserListView
, which enables to click on folders and files via a list, but it also makes it possible to have a littel '>' sign at the beginning of every list element, which are directories.
I realized that when I used these '>' signs, then I get wrong path, but if I always clicks on the directories' list elements then everything works fine.
However, that little '>' cannot be disabled (for now), so the best and fastest alternate solution is using
FileChooserIconView
instead!
Now everything is good :)

Resources