ASP Delete File from server
I have made a file sharing app, and the description and file
name are stored in my access db, when i delete the recordset for
the file i also want to delete the actual file. i am able to delete
the file with the full path entered and the file name as a
variable,
with this code:
<%
Dim filepath
filepath = Session("file_del")
set filedel = CreateObject("Scripting.FileSystemObject")
filedel.DeleteFile("C:\localhost\CallCenter\EMPLOYEE_FILES\"&
filepath), True
set filedel = nothing
%>
I put the name of the file in the file_del session variable
on the page that deletes the recordset.
But i would like to make it work on my hosted site without
having to change the path to my sites, so i have made this code:
<%
Dim filepath
filepath = Session("file_del")
strPhysicalPath = Server.MapPath(filepath)
set filedel = CreateObject("Scripting.FileSystemObject")
filedel.DeleteFile strPhysicalPath , True 'Line that causes
ERROR
set filedel = nothing
%>
But the error comes File Not found.
if i just display the strPhysicalPath variable on the page
without the delete action it displays the proper path.
how can i get the strPhysicalPath to be read, i have tried
all of the ways i can think of
filedel.DeleteFile strPhysicalPath , True
filedel.DeleteFile & strPhysicalPath & , True
filedel.DeleteFile (strPhysicalPath) , True
filedel.DeleteFile ("" & strPhysicalPath & "") , True
filedel.DeleteFile ( & strPhysicalPath) , True
But none of them work ?
Any help would be great
After some rest and a closer examination, i realized the
error was in the mappath line, it wasnt including the folder that
held the files. strPhysicalPath = Server.MapPath(filepath) was
wrong so, I added the folder name: strPhysicalPath =
Server.MapPath("EMPLOYEE_FILES/" & filepath) then the file is
deleted. so complete code is:
<%
Dim filepath, strPhysicalPath
filepath = Session("file_del")
strPhysicalPath = Server.MapPath("EMPLOYEE_FILES/" &
filepath)
set filedel = CreateObject("Scripting.FileSystemObject")
filedel.DeleteFile (strPhysicalPath), True
set filedel = nothing
%>
Similar Messages
-
Rather that putting or getting files from the server, how do
I delete them off of the server? I've been clicking on a file, then
right clicking and selecting delete, but does this actually remove
the file off of the server?
I've perused the internet and the help menu and can't find
the answer-is that because it's as obvious as what I am doing
already?
Thanks in advance for any help offered!
p>>right clicking and selecting delete, but does this
actually remove the
>>file off of the server?
It does if you're using Remote View in the Files panel.
Walt
"sdluthier" <[email protected]> wrote in
message
news:ggk4a3$atf$[email protected]..
> Rather that putting or getting files from the server,
how do I delete them
> off
> of the server? I've been clicking on a file, then right
clicking and
> selecting
> delete, but does this actually remove the file off of
the server?
>
> I've perused the internet and the help menu and can't
find the answer-is
> that
> because it's as obvious as what I am doing already?
>
> Thanks in advance for any help offered!
> p
> -
How to delete file from server with space in name
I am a novice, learned a little several years ago, but have to start all over again.
I have set up the remote server (upload.comcast.net) without problems. I am unable to delete a file (file error:). I was able to upload the file, but cannot delete it. I figured out that that filename has a leading space. Now it's up on the server, but I cannot access it.
Experiment:
On the local folder, I deleted the leading space, and was able to upload, and delete it successfully. The original file remains unaccessible on the remote server.
Thanks,
SonnyThanks for getting back so fast.
Here is the error:
/_4230151.ORF - error occurred - An FTP error occurred - cannot delete remote file _4230151.ORF. Access denied. The file may not exist, or there could be a permission problem. Make sure you have proper authorization on the server and the server is properly configured
As I mentioned before, I don't think that there is an authorization problem, as the changed name works fine, as does index.html
What I do find interesting is that I was able to upload the file with the leading space. If I remember from several years ago, such a file would not even upload.
I shutter to think of contacting Comcast. I think that they just give us the space with internet cable, but we are on our own with the website. Do you think that there might be some way to erase everything? I have only index.html up there, and don't mind starting over again.
Sonny -
Process Chain - Delete File from Application Server
Hi Gurus,
Im working with Process chain, and i have a load from a flat file, so my question is :
How can i delete that file from the application server after was loaded ?
THANKS IN ADVANCED !!! I REALLY APRECCIATE YOUR HELP.
Marcoshi,
I have gone through the forum you have posted for deleting files from application server through process chain.
I have similar reuirement in my project.
Can you please provide me the solution?
Your inputs will be highly appreciated.
Thanks in advance.
Regards,
Lavanya. -
Deleting file from application server
can any one tell me how to delete file from application server?
Hi,
Use statement
delete dataset 'tmpfile.txt'.
\tmp\file.txt is the file path on application server which you want to delete.
Regards
Sailaja. -
T-code for delete file from application server
Hi all!
Please, has any t-code for delete file from application server? For upload exist CG3Z, for download has CG3Y. And for delete? Has anyone?
I need to delete file from application server in QA system and i don't want to create a program for this because i will need to transport a request from DEV to QA.I don't have contact with basis team.
The FM EPS_DELETE_FILE support directory name with max 60 char. My dir. has more than that. I need a transaction for this.
Anybody know if this transaction exist? -
How to delete file from Window server
Hi
Can anybody tell me that Is there any function module for deleting file from presentation server like C directory.
Quick suggestion will highly be appreciated!!!!!!!Try this:
CALL METHOD cl_gui_frontend_services=>file_delete
EXPORTING
filename =
changing
rc =
EXCEPTIONS
FILE_DELETE_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
FILE_NOT_FOUND = 4
ACCESS_DENIED = 5
UNKNOWN_ERROR = 6
NOT_SUPPORTED_BY_GUI = 7
WRONG_PARAMETER = 8
others = 9
this is pretty gud approach .
Message was edited by:
Nishant Rustagi -
Delete WorkBook and Query file from Server .
Dear All Experts .
I dun know i posted in correct places or not .. (correct me if i m wrong) .. i want to ask about the BW Workbook and query.
How we going to remove the remove the workbook or query files from Server ? bc i tried to delete from Analyzer(excel 2007), the file is deleted from the view , but havent delete from the server... So how i going to remove the file from server ?
Thank.Hello I have the same problem. Can you please tell me how you finaly manage to delete the workbook.
thank's you for advance,
Akiba -
Windows Server 2012 R2 RDS: RDS Users are unable to delete files from their desktop
Hello,
We are working with Windows Server 2012 R2 RDS. We also implemented User Profile Disks. This is all working fine without problems. The only issue I have is that normal users are unable to delete files from their desktop. They are getting a message:
you'll need administrator permission to delete this file, with the prompt for administrator access.
They can edit, copy, rename, cut and paste files. But they cannot delete a file from their desktop.
I checked the security permissions of the files on the desktop (for example a normal self-created PDF file) and the users are owner and have "Full Control" over the files.
I checked the file permissions and took a look under "Advanced", selecting the specific domain user and checked the "Advanced Permissions" and the user has the "Delete" option checked. So he should be able to delete the
file.
I am guessing this is UPD related issue, or something in GPO. But I already unlinked the GPO objects, that I felt could be the source of this problem, but without results.
Could someone give me a hint on where to look? It's kinda annoying to users, that they can't delete their own files.Hello Bria,
What you should check first, is the NTFS permissions on the User Profile Disk to begin with. See if the user has full control over the items that are in the UPD.
Also check the GPO's that are enabled for the user and computer account. You can check that by running: gpresult /h <path>\gpresult.html
There are two GPO settings that could prevent the user from deleting his/her own items:
User
Configuration\\Policies\\Administrative Templates\\Windows Components\\Windows Explorer\
Hide these specified drives in My Computer
Prevent access to specified drives in My
Computer
There might be other GPO settings, that block deleting items on the UPD, but can't think of any out of my head.
I can only think NTFS and GPO settings that might prevent the user from deleting items. In my case it was a GPO setting, that I didn't suspect. -
HOw to delete files from remote server?
Hi,
I want to delete files from a directory on remote server.
I use the following command to delete on current server:
find $srcdir -mtime +90 -name "COR*.txt" -exec rm -f {} \;
Now, how can I delete files from remote server ?
Thanks!
YoginiSome possible options:
1. There exists SSH implementation for Windows.
2. You can make a workaround. You can setup share for specific/wanted directory.
Then you can mount it on Linux machine and execute command localy and delete files "localy" in mounted directory.
3. You can setup FTP server on Windows machine and do that remotely via FTP commands. -
Delete file from directory which
Hi ,
I want to delete files from a directory in Application server.
I have the file name as fn_13/07/2007.txt
Have a condition that files should be deleted which are less than 10 days.
Is there any function module to do this.
Thanks in Advance.
Regards,
IndhraHello Indhra,
These methods may help ( from CL_GUI_FRONTEND_SERVICES )
<b>DIRECTORY_BROWSE</b> Static Method Public Shows a Directory Selection Window
<b>DIRECTORY_CREATE</b> Static Method Public Creates a Directory in the Client
<b>DIRECTORY_DELETE</b> Static Method Public Deletes a Directory in the Client
<b>DIRECTORY_EXIST</b> Static Method Public Checks if a directory exists
<b>DIRECTORY_GET_CURRENT</b> Static Method Public Returns the Current Directory
<b>DIRECTORY_LIST_FILES</b> Static Method Public Lists Files in a Given Directory
<b>DIRECTORY_SET_CURRENT</b> Static Method Public Sets the Current Directory (Do NOT Use)
<b>ENVIRONMENT_GET_VARIABLE</b> Static Method Public Gets an Environment Variable
<b>ENVIRONMENT_SET_VARIABLE</b> Static Method Public Sets an Environment Variable
<b>EXECUTE</b> Static Method Public Starts an Application or Opens a Document in the Client
<b>FILE_COPY</b> Static Method Public Copies a File
<b>FILE_DELETE</b> Static Method Public Deletes a File -
BOBJ is unable to delete file from OFRS
System Info:
Business Objects Enterprise XI3.1 SP3 FP3.2
Windows 2003 Server Enterprise Edition SP3
Oracle 10.2
Java 1.6.0_20
APACHE Tomcat 5.5.20
2 clustered servers
FRS located on SAN Disk Drive connected to primary server (Winchester1)
We use WebIntelligence exclusivly.
We are receiving the following error in our event log on our clustered server:
Source: BusinessObjects_CMS
Category: General
Type: Warning
Event ID: 33018
Computer: Winchester2
Unable to delete file from the file repository. Make sure a File Repository Server is running and registered and enabled. Details : Failed to connect to the File Repository Server output. Make sure the server is up and running.
We have verified the FRS is running and we are able to connect to it from our clustered server (Winchester2). The security settings are set to full control for the admin group and the users have Read/Write access to the file store folders. The errors are filling up our event logs and causing issues with the servers. this appears to be happening each morning and the file it is trying to delete is an .xls file.
We have a ticket open with SAP Support but they are just as baffled as we are and keep sending us from one group to another and tell us they need to look at it on thier end and they will get back to us.
Has anyone had this happen on their system?Hi Richard, did you ever get this issue resolved? We are having a similar issue on XI R3 SP4 using NAS/CIFS shares for our File Stores. We see this issue mainly after our servers are patched and a full environment restart is initiated. Like you, our event logs fill up with so many error messages I cannot pinpoint exactly when the issue starts happening.
Any help would be much appreciated. -
Hi Experts,
I have a requirement in my application, that list out the files from the server in table and also delete the file. Pls specify the code.
Regards,
Kiruba.RHi
List all the files from server
public void listServerFiles( )
//@@begin listServerFiles()
wdContext.nodeFiles().invalidate();
IPrivateExperimentView.IFilesElement element;
java.io.File file = new java.io.File( "D:\\Test");
File list[] = file.listFiles();
for( int i = 0; i < list.length; i++)
element = wdContext.createFilesElement();
element.setFileName( list[ i].getName());
wdContext.nodeFiles().addElement( element);
//@@end
Display the selected file
public void onActiondownload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActiondownload(ServerEvent)
IWDResource resource;
String name = wdContext.currentFilesElement().getFileName();
String path = "D:\\Test\\" + name;
InputStream stream;
try {
stream = new FileInputStream(path);
resource = WDResourceFactory.createResource( stream, name,
WDWebResourceType.UNKNOWN, true);
stream.close();
wdComponentAPI.getWindowManager()
.createNonModalExternalWindow( resource.getUrl( 0), name).show();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Delete the selected file
public void onActiondeleteFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActiondeleteFile(ServerEvent)
String path = "D:\\Test\\" + wdContext.currentFilesElement().getFileName();
File file = new File( path);
file.delete();
listServerFiles();
//@@end
vinod -
Delete file Application Server
Hi ...
I have an application wrote with Forms Dev. ... Is it possible delete a file on the application server ??
Is it also possible delete a file in the Application server by a stored procedure ??
Thank's in advanceIt is also possible to implement a java procedure on the database being invoked with a PL/SQL wrapper class.
In this way (and if used right) there is also granularity regarding the filestructure permissions given and it may be called during a Forms or other PL/SQL session.
As it is a requirement in this post to delete file from the AS, the database instance holding the JAVA class needs to be installed on the Application Server itself (which is not recommended anyway). But the article below explains a more generic approach how to invoke shell commands from within an Oracle Instance.
Be careful with this, because it really works ;)
Refer to :
http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
Message was edited by:
user434854 -
Trying to delete file from trash but get this: The operation can’t be completed because the item “File name” is in use. All other files delete except this one. Please help
Maybe some help here:
http://osxdaily.com/2012/07/19/force-empty-trash-in-mac-os-x-when-file-is-locked -or-in-use//
Maybe you are looking for
-
Hi to all, I am facing a problem in ECC5.0 and stuck in stock transport order between plant to plant. I have followed the steps as below: Creating stock transport order. Creating Outbound delivery Doing PGI creating performa invoice - Billing documen
-
Hello, i'm Gabriele. I'm from Italy, i'm 16 years old. One month ago, i have updated my iPhone 4 to iOS 7...why i did it??? UNUSABLE ( also with "reduce speed" in preference) but nothing...How can i donwgrade my iPhone 4 to whichever iOS 6? i can't a
-
Has anyone managed to get Authorware 7 Content Working on the Web
Hi I get this message when I try to get the web player working Can anyone help!! [email protected]
-
Partial insert with secondary index
I'd like to use partial inserts (DB_DBT_PARTIAL). However, I also need secondary indexes. Now when I insert partial data, the secondary index function is immediately called, but still I do not have enough data to calculate the secondary key. I tried
-
Brother printer app for macbook air
For some reason i can get the app for my printer (brother) on the app store on my iphone but not on my macbooks app store