473,551 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Upload Files using the CGI.pm Module and Perl

KevinADC
4,059 Recognized Expert Specialist
Note: You may skip to the end of the article if all you want is the perl code.

Introduction

Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users to do many things without the need to understand very much of the underlying technology.

This article is not a perl tutorial per se. I am not going to go into much of the behind the scenes details that makes it all work. Some sections will have to include short explanations and of course perl code, but the goal is not to teach the reader perl programming or general Internet concepts. I assume you have some experience with HTML and maybe have uploaded and installed a perl script or two in the past and know how to do that. Consider this article more of a "How To" lesson.

The perl script I am going to introduce you to uses only core modules that come with perl so there is no need for you to install any modules. All you will need is any fairly recent version of perl. Of course perl has to be installed on the server where you will run the script. There is also a list of online resources you can access for more general information concerning many of the details that will be discussed in this article.

Getting Started

First, you will need a form. You see them all the time on the Internet. You fill in some information and click a button to send data to a server. That is a form. The precise name is a CGI (Common Gateway Interface) form. CGI is a protocol, which simply means a set of rules that allows your computer to communicate with a remote server. As long as the server is setup to accept CGI form data, and most are, then all is well. You really don't need to know any of that, so don't worry if it sounds confusing.

The CGI Form

Following is a very simple CGI form: one file field, where the user chooses a file to upload, and one text field, where the user will enter their email address. I include the text field just as an example, it is not required if all you want is a file upload field. You can optionally add many other form fields, and even more "file" fields, that will send data to the server all at the same time.

Expand|Select|Wrap|Line Numbers
  1. <FORM ACTION="/cgi-bin/upload.pl" METHOD="post" ENCTYPE="multipart/form-data">
  2. <INPUT TYPE="file" NAME="photo">
  3. <INPUT TYPE="text" NAME="email">
  4. <INPUT TYPE="submit" NAME="Submit" VALUE="Submit Form">
  5. </FORM>
  6.  
The above form would be embedded in an HTML document with all the appropriate tags that an HTML document should have. If you are unsure what those are you should read a basic HTML (or web page) tutorial. For a file upload script the ENCTYPE="multip art/form-data" and the TYPE="file" are the most important. The ACTION="/cgi-bin/upload.pl" tells the form where to send the data. In this case to your perl script named upload.pl in your cgi-bin folder where most cgi/perl scripts should be stored on a web server. Save the form as a web page named upload.html, or any name you prefer and upload it to your web host account. If you do not have a web host account there is not much need to continue from this point.

The CGI Script

Just about all perl scripts that run as a CGI process need to start with what is called the shebang line. The most common shebang line is:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
It simply tells the server where to find perl. The shebang line your server requires might be different. Most web hosts will have that information posted on their site somewhere. In the interest of good perl coding practices and security we are going to add a switch to the shebang line: -T. Note: it must be an uppercase T.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -T
The T stands for "taint" mode. This is really to prevent you, as the programmer of the script, from making a terrible mistake and allowing the users of your CGI form to send data to the server that can be used in an insecure way. This file upload program is really very simple and will not allow users to do any such thing, but all perl scripts that run as a CGI process should use the -T switch so I include it for that reason.

Modules

Modules are sort of like separate perl programs you can use in your perl program. Many people have written modules that have become standards that other perl programmers use all the time. We will be using these modules:

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3. use CGI;
  4. use CGI::Carp qw/fatalsToBrowser/;
  5. use File::Basename;
  6.  
The first two are not modules, they are pragmas. They affect the way perl itself functions. I am not going to explain them for the purpose of this article. You will have to trust me that they are important to use in nearly all of your perl programs. The "CGI" module is the module that will do all the heavy lifting for us. It will process the form data and store it on the server. The "CGI::Carp" module is really for debugging and may help you to get your script running if you have problems. If there are any fatal errors that cause the script to fail, it will print an error message to the screen. These are the same errors that will be printed in the server error log too. "File::Basename " is a module that can be used to split a filename/filepath into it's separate parts for easy processing by your script. We will use it to get just the filename and the file extension into our script.

Setting Some Limits

In my opinion, all CGI scripts should set a limit on how much data can be transferred to the server. Otherwise, some dork with a T1 line will start transferring gigabytes of data to your server and either make it unavailable to other users, or use up all your allotted disk space. Here is how we can set a limit using the CGI module:

Expand|Select|Wrap|Line Numbers
  1. $CGI::POST_MAX = 1024 * 5000; # adjust as needed (1024 * 5000 = 5MB)
  2. $CGI::DISABLE_UPLOADS = 0; # 1 disables uploads, 0 enables uploads
  3.  
The first line establishes the maximum amount of data (in bytes) the script will allow to be stored on the server. It's not perfect because it has to receive all the data before it knows there is too much. So a person can still try and send way more data than you want them to, but the script will reject it. But for the most part it works well enough. The second line allows you an easy way to completely disable file uploads. You may want to do this occasionally if you are doing some type of maintenance to your website and don't want people to upload files during that time.

Creating a new CGI Object or Hiring a Butler

Here is what is so great about using the CGI module (and many other modules). To access all the functions of the CGI module all you need to do is add this line to your script:

Expand|Select|Wrap|Line Numbers
  1. my $query = CGI->new;
This creates the $query object that we will use for the rest of the script. The object is sort of our personal butler. We tell the butler what to do using simple commands and he goes and does it for us.
Note: $query can be any valid scalar name.
Note: CGI->new is not absolutely necessary. There is another way to use most of the functions of the CGI module called "standard". Read the CGI module documentation if you are interested.

Houston, We Have A Problem

I hope you know what that means, if not, don't worry about it. This next section of the code will check if the version of the CGI module is new enough to use in the manner we want to use it. Any server still using a version older than 2.47 should probably be shut down, but I include it to be complete.

Expand|Select|Wrap|Line Numbers
  1. unless ($CGI::VERSION >= 2.47) { 
  2.    error('Your version of CGI.pm is too old. You must have version 2.47 or higher to use this script.')
  3. }
  4. }
  5.  
If the version is too old the script sends an error message to the "error()" subroutine alerting the user of the error.

Where to Store Uploaded Files

This line might be your biggest cause for concern:

Expand|Select|Wrap|Line Numbers
  1. my $upload_dir = '/home/you/public_html/uploads';
You have to determine what '/home/you/public_html/uploads' should be. Since you probably want the files to be visible to people that visit your website, you would want to place the files in a folder below the root web folder. Most servers callthe root web folder "public_htm l", some call it "www". The path to "public_htm l" is generally something like:

/home/you/public_html/

where "you" is your unique identifier. It might be part of your websites name or something different. Most web hosts will have that information posted on their website somewhere. Add "uploads" to the end:

/home/you/public_html/uploads

and that is the folder where file uploads will be stored. If you did not want people to see the files you would place them in a folder parrallel to the root web folder:

/home/you/uploads

or possibly above it:

/home/uploads

Validating user Input or Keeping the Riff-Raff Out

The first rule of CGI programming is: Never trust user input. Because of this lack of trust, all CGI scripts should do what is called validating user input. In our case we don't have much user input, just an email address and the file to upload. But you still have to check both of them. Filenames on the internet should really only consist of a limited group of characters, they are:

a thru z, A thru Z, 0 thru 9 _ (underscore) . (dot) - (dash)

written in perlish form: 'a-zA-Z0-9_.-'

We will use this list of characters to check (and change if necessary) filenames that are going to be uploaded. We define that list like so:

Expand|Select|Wrap|Line Numbers
  1. my $filename_characters = 'a-zA-Z0-9_.-';
Note: Like much of perl, this could be done a number of different ways. I am trying to keep this fairly simple so I elected to use this method for readability and simplicity sake.

Reading in the Form Fields

Here we tell our butler, $query, to let our "visitors" into our "home".

Expand|Select|Wrap|Line Numbers
  1. my $file = $query->param("photo") or error('No file selected for upload.') ;
  2. my $email_address = $query->param("email") || 'Annonymous';
  3.  
Note how the names in parenthesis match the names in our form fields above:

Expand|Select|Wrap|Line Numbers
  1. <INPUT TYPE="file" NAME="photo">
  2. <INPUT TYPE="text" NAME="email">
  3.  
The case is also important. "Photo" is not the same as "photo". We put the values of the param() calls into some perl variables so we can alter them and use them later in the script.

If no file was selected to upload the script sends an error message to the "error()" subroutine alerting the user of the error. If no email address is entered $email_address will be assigned a value of "Annonymous ".

Some browsers send the whole path to a file instead of just the filename. The next line will parse the filename and file extension (ie: .jpg .gif .txt, etc) from the filepath if necessary. "fileparse( )" is a function of the File::Basename module:

Expand|Select|Wrap|Line Numbers
  1. my ($filename,undef,$ext) = fileparse($file,qr{\..*});
If the browser sent something like "c:\windows \my documents\frog pictures\big frog!!!.gif" we will end up with only "big frog!!!" and ".gif".

The next lines validate and change the filename if necessary to make sure it complies with our list of characters:

Expand|Select|Wrap|Line Numbers
  1. # append extension to filename
  2. $filename .= $ext;
  3.  
  4. # convert spaces to underscores "_"
  5. $filename =~ tr/ /_/;
  6.  
Now "big frog!!!.gif" will be "big_frog!!!.gi f".

Expand|Select|Wrap|Line Numbers
  1. # remove illegal characters
  2. $filename =~ s/[^$filename_characters]//g;
  3.  
Now $filename will equal "big_frog.g if". Which is now our validated filename.

The next several lines will allow your script to use the filename to store the data on the server by "untainting " the filename. This is where the -T switch comes in the picture. Allowing user input to be used as a filename is considered insecure, and it is! I am not going to go into details. Suffice it to say, the perl program assumes that you, the programmer,know s what you are doing, and will not throw an error at you and abort the script for allowing insecure input to be used in an insecure way.

Expand|Select|Wrap|Line Numbers
  1. # satisfy taint checking
  2. if ($filename =~ /^([$filename_characters]+)$/) {
  3.    $filename = $1;
  4. }
  5.  
If for some reason the filename did not meet the conditions above (and it always should) the "else" conditional will send an error message to the "error()" subroutine alerting the user of the error.

Expand|Select|Wrap|Line Numbers
  1. else{
  2.    error("The filename is not valid. Filenames can only contain these characters: $filename_characters")
  3. }
  4.  
The next "unless" condition does a very crude validation of the email address. To reliably validate an email address I recommend using the Email::Valid module. I did not include it in this script because it is not a core module.

Expand|Select|Wrap|Line Numbers
  1. unless ($email_address eq 'Annonymous' or ($email_address =~ /^[\w@.-]+$/ && length $email_address < 250)) {
  2.    error("The email address appears invalid or contains too many characters. Limit is 250 characters.")
  3. }    
  4.  
Upload the File

If the script has got this far, it assumes all is good and will now upload the file to the destination directory and store it under the filename ($filename).

"$query->upload()" is the function that turns the file field name in the CGI form into a filehandle: <$upload_fileha ndle>.

Expand|Select|Wrap|Line Numbers
  1. my $upload_filehandle = $query->upload("photo");
Here we open a new file in the $upload_dir using the filename.

Expand|Select|Wrap|Line Numbers
  1. open (UPLOADFILE, ">$upload_dir/$filename") or error("Can't open/create \"$upload_dir/$filename\": $!");
This line tells perl to use binary mode on the filehandle:

Expand|Select|Wrap|Line Numbers
  1. binmode UPLOADFILE;
The "while" loop reads in the file the user is uploading into the file we opened above.

Expand|Select|Wrap|Line Numbers
  1. while ( <$upload_filehandle> ) {
  2.    print UPLOADFILE;
  3. }
  4.  
Now close the file:

Expand|Select|Wrap|Line Numbers
  1. close UPLOADFILE;
Print a "Thank you" message to alert the user all went well and display the image and the email address.
Our "butler", $query, handles all the HTML code printing chores for us using various commands.

Expand|Select|Wrap|Line Numbers
  1. print $query->header(),
  2.       $query->start_html(-title=>'Upload Successful'),
  3.       $query->p('Thanks for uploading your photo!'),
  4.       $query->p("Your email address: $email_address"),
  5.       $query->p("Your photo $filename:"),
  6.       $query->img({src=>"../uploads/$filename",alt=>''}),
  7.       $query->end_html;
  8.  

The "error()" Subroutine

Last but not least is our only private subroutine. It simply prints the error messages sent to it from the script. Once again, $query handles the HTML code printing for us. The last line in the subroutine, exit(0), tells perl to end the script after printing the error message. If we did not include the exit() function perl would continue to try and process the rest of the script.

Expand|Select|Wrap|Line Numbers
  1. sub error {
  2.    my $error = shift;
  3.    print $query->header(),
  4.          $query->start_html(-title=>'Error'),
  5.          $error,
  6.          $query->end_html;
  7.    exit(0);
  8. }
  9.  
Review

As mentioned above, the first rule of CGI programming is: Never trust user input. CGI scripts should not allow users to send data that the script does not expect or handle data in insecure ways. CGI security is beyond the scope of this article but there is an online resource in the "Resources" section you can read for more details.

Uploading a file is fairly easy using the CGI module. Really, it's very easy once you are familiar with the many methods/functions the wide-ranging CGI module has to offer. With a small change to the code I wrote for this article you could allow users to upload multiple files at the same time and include lots of other CGI form data as well. The CGI module is one of the bigger perl modules there is and the documentation is extensive but can still be confusing to the novice perl programmer.

The script I posted can be used in a production environment, but keep in mind the email address field is not properly validated. As mentioned previously, use the Email::Valid module when you need to validate email addresses. You may need to install it, but that is a subject for another article.

Kevin (aka KevinADC)

Resources

Websites:

Perldoc Website All the perl documentation online.
Search CPAN Comprehensive Perl Archive Network. A gigantic repository of perl modules
and more.
CGI Security A primer on CGI security.

Perl Pragmas:

Strict The strict pragma documentation (on perldoc).
Warnings The Warnings pragma documentation (on perldoc).

Core Modules:

CGI The CGI module documentation (on perldoc).
CGI::Carp The CGI::Carp module documentation (on perldoc).
File::Basename The File::Basename module documentation (on perldoc).

Other Modules:

Email::Valid The Email::Valid module documentation (on cpan).

This article is protected under the Creative Commons License.


The Complete Script
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -T
  2.  
  3. use strict;
  4. use warnings;
  5. use CGI;
  6. use CGI::Carp qw/fatalsToBrowser/;
  7. use File::Basename;
  8.  
  9. $CGI::POST_MAX = 1024 * 5000; #adjust as needed (1024 * 5000 = 5MB)
  10. $CGI::DISABLE_UPLOADS = 0; #1 disables uploads, 0 enables uploads
  11.  
  12. my $query = CGI->new;
  13.  
  14. unless ($CGI::VERSION >= 2.47) { 
  15.    error('Your version of CGI.pm is too old. You must have verison 2.47 or higher to use this script.')
  16. }
  17.  
  18. my $upload_dir = '/home/mywebsite/htdocs/upload';
  19.  
  20. # a list of valid characters that can be in filenames
  21. my $filename_characters = 'a-zA-Z0-9_.-';
  22.  
  23. my $file = $query->param("photo") or error('No file selected for upload.') ;
  24. my $email_address = $query->param("email") || 'Annonymous';
  25.  
  26. # get the filename and the file extension
  27. # this could be used to filter out unwanted filetypes
  28. # see the File::Basename documentation for details
  29. my ($filename,undef,$ext) = fileparse($file,qr{\..*});
  30.  
  31. # append extension to filename
  32. $filename .= $ext;
  33.  
  34. # convert spaces to underscores "_"
  35. $filename =~ tr/ /_/;
  36.  
  37. # remove illegal characters
  38. $filename =~ s/[^$filename_characters]//g;
  39.  
  40. # satisfy taint checking
  41. if ($filename =~ /^([$filename_characters]+)$/) {
  42.    $filename = $1;
  43. }
  44. else{
  45.    error("The filename is not valid. Filenames can only contain these characters: $filename_characters")
  46. }
  47.  
  48. # this is very crude but validating an email address is not an easy task
  49. # and is beyond the scope of this article. To validate an email
  50. # address properly use the Emaill::Valid module. I do not include
  51. # it here because it is not a core module.
  52. unless ($email_address =~ /^[\w@.-]+$/ && length $email_address < 250) {
  53.    error("The email address appears invalid or contains too many characters. Limit is 250 characters.")
  54. }    
  55.  
  56. my $upload_filehandle = $query->upload("photo");
  57.  
  58. open (UPLOADFILE, ">$upload_dir/$filename") or error($!);
  59. binmode UPLOADFILE;
  60. while ( <$upload_filehandle> ) {
  61.    print UPLOADFILE;
  62. }
  63. close UPLOADFILE;
  64.  
  65. print $query->header(),
  66.       $query->start_html(-title=>'Upload Successful'),
  67.       $query->p('Thanks for uploading your photo!'),
  68.       $query->p("Your email address: $email_address"),
  69.       $query->p("Your photo $filename:"),
  70.       $query->img({src=>"../uploads/$filename",alt=>''}),
  71.       $query->end_html;
  72.  
  73.  
  74. sub error {
  75.    print $query->header(),
  76.          $query->start_html(-title=>'Error'),
  77.          shift,
  78.          $query->end_html;
  79.    exit(0);
  80. }
  81.  
This article is protected under the Creative Commons License.
Attached Files
File Type: txt upload.txt (2.4 KB, 2445 views)
Jul 4 '07 #1
21 34352
KevinADC
4,059 Recognized Expert Specialist
Comments and discussion are welcome. Proof readers are also needed.
Jul 4 '07 #2
bkrawal
1 New Member
Comments and discussion are welcome. Proof readers are also needed.
Hi,
I tried this script but was unable to upload file through firefox. I was able to upload files using IE. Is there any dependency on browser?
Sep 24 '07 #3
KevinADC
4,059 Recognized Expert Specialist
Hi,
I tried this script but was unable to upload file through firefox. I was able to upload files using IE. Is there any dependency on browser?

Works for me with FireFox (v 2.0.0.7) but I assume it will work with any version of any browser. The html code is very a very simple form that should be supported even in very old browsers. What happens when you use FireFox? Quote from article:

The above form would be embedded in an HTML document with all the appropriate tags that an HTML document should have.
Did you embed the form inside an html document?

<html>
<head>
</head>
<body>
form code here
</body>
</html>
Sep 25 '07 #4
eWish
971 Recognized Expert Contributor
Kevin,

I want to say that your article is nice and well written. Look forward to seeing more articles from you in the future.

---eWish
Oct 16 '07 #5
Kelicula
176 Recognized Expert New Member
Kevin,

I want to say that your article is nice and well written. Look forward to seeing more articles from you in the future.

---eWish
I would only point out (and I could be wrong) that I believe you would have to escape the "." in the validating user input section.
ie:
Expand|Select|Wrap|Line Numbers
  1. my $filename_characters = 'a-zA-Z0-9_.-';
  2.  
I think it should be:
Expand|Select|Wrap|Line Numbers
  1. my $filename_characters = 'a-zA-Z0-9_\.-';
  2.  
Since dot represents any character.

??

Otherwise, incredible article that will come in very useful for me personally soon.

Thanks!!
Oct 24 '07 #6
eWish
971 Recognized Expert Contributor
When a metacharacter is used in a character class (hence the [] brackets) then it becomes literal and does not have to be escaped.
Expand|Select|Wrap|Line Numbers
  1. if ($filename =~ /^([$filename_characters]+)$/) {
Oct 25 '07 #7
KevinADC
4,059 Recognized Expert Specialist
I would only point out (and I could be wrong) that I believe you would have to escape the "." in the validating user input section.
ie:
Expand|Select|Wrap|Line Numbers
  1. my $filename_characters = 'a-zA-Z0-9_.-';
  2.  
I think it should be:
Expand|Select|Wrap|Line Numbers
  1. my $filename_characters = 'a-zA-Z0-9_\.-';
  2.  
Since dot represents any character.

??

Otherwise, incredible article that will come in very useful for me personally soon.

Thanks!!
The dot in a character class [] is just a dot. It's not a wild card. You can easily test that:

Expand|Select|Wrap|Line Numbers
  1. $foo = 'test';
  2. print $foo =~ /[.]/ ? 'true' : 'false';
  3.  
The above prints 'false' because there is no dot in $foo. Remove the character class brackets and try again:

Expand|Select|Wrap|Line Numbers
  1. $foo = 'test';
  2. print $foo =~ /./ ? 'true' : 'false';
  3.  
Now it prints 'true' because the dot is a wild card.
Oct 28 '07 #8
KevinADC
4,059 Recognized Expert Specialist
When a metacharacter is used in a character class (hence the [] brackets) then it becomes literal and does not have to be escaped.
Expand|Select|Wrap|Line Numbers
  1. if ($filename =~ /^([$filename_characters]+)$/) {
Not all meta characters are treated as literal characters in a character class. This is one area where you have to learn what the rule is for each character and how it is interpreted inside of square brackets.
Oct 28 '07 #9
eWish
971 Recognized Expert Contributor
That is true. I should have worded that differently.
Oct 28 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
11111
by: Stephane | last post by:
Hello, I need to allow an end user to upload video files on a server and in the same time to put the file name and a few infos in a database. It must be very simple for the end user, and uploading with a browser in a form would be perfect since it allows to upload and fill a form in the same time. I'll have full control of the server (no...
9
2728
by: Bob Bedford | last post by:
I've a page where the user may enter some values and upload some pictures. Unfortunately, some pictures coming from digital camera are very big, and take a lot of time for uploading. I've created a DIV that I show when uploading, but this uses DHTML and javascript, wich are not available everywhere. How to do something like:
11
2954
by: john_ramsden | last post by:
I have to prepare an Apache/PHP based (or perl if easier) web page that allows a user to upload very large files, possibly over 10 Gbytes and maybe up to 100 Gbytes. I'm aware that file upload limits can be increased by config changes; but I'd rather minimize the need for changes like this, both for admin reasons and to avoid possible (?)...
0
3776
by: ShaSha | last post by:
Hi, I am trying to upload XML files via HTTP to an HTTP server from java client instead of browser. On the HTTP server side, there is a Perl script that will be receiving the incoming file and files it into the designated folders in the server.When I run the Java client, I get the response Status = 200 and also uploaded replies from the Perl...
9
20880
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at rapidshare news : http://images.rapidshare.com/software/rsapi.pl If you test it you will see that you can upload one file at time. I try...
6
13210
by: skyy | last post by:
Hi.. i would like to know how to handle multiple upload files with the cgi module in perl script.. With single file, my $my_cgi new CGI; my $upload_filehandle = cgi ->upload('file1'); my $filename = $cgi->param('file1'); $filename =~ s/.*(.*)/$1/; if ($upload_filehandle) {
2
2597
by: skyy | last post by:
Hi... i am doing some CGI script using perl. I would like to create a progress bar to indicate the progress of the uploading. Is this possible? i don't have the CGI::ProgressBar module... Is it possible to get the number of bytes transfered then divide by the size of the file to upload and then draw a simple image through html?
1
2111
by: fortwilliam | last post by:
Hi, I am very new to "object oriented programming". I have this script which I didn't write but have altered and have been using for a while to allow people to upload files to a website. Now I am trying to adapt the same script to upload files to multiple websites specified in an array. This is for a content management system for our websites. I...
0
7565
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7768
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6106
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5130
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3534
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3520
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.